This is great! I've started using it for new classes and to replace existing uses on project model I have and I've found some issues:
1) When the use belongs to the same namespace route, bouml generates partial use path.
i.e for "Cat" belonging to "\Animals\Mammals" namespace, a realization dependency stereotyped as "use-as Feline" to "\Animals\Mammals\FelineInterface":
bouml generates:
- Code: Select all
<?php
namespace \Animal\Mammals;
use FelineInterface as Feline;
class Cat implements Feline {
// ---
}
For PHP this is not correct since it expects a full definition path, and the generated "Feline" use is referencing to "\FelineInterface" instead of "\Animals\Mammals\FelineInterface". Adding a full path to use statement corrects this.
should be:
- Code: Select all
<?php
namespace \Animals\Mammals;
use \Animals\Mammals\FelineInterface as Feline;
class Cat implements Feline {
// ---
}
This is the most important fix for me to use this feature everywhere.
2) When I was testing case one I've found that when you change the regular realization of FelineInterface to a stereotyped "use-as Feline" realization, php generator skips the require_once statement.
i.e generated regular FelineInterface realization:
- Code: Select all
<?php
namespace \Animals\Mammals;
require_once 'animals/mammals/FelineInterface.php';
class Cat implements FelineInteface {
// ---
}
generated stereotyped "use-as Feline" realization with the same artifact:
- Code: Select all
<?php
namespace \Animals\Mammals;
use FelineInterface as Feline;
class Cat implements FelineInteface {
// ---
}
I normally don't use require_once since I use autoloaders for classes, but maybe it's an issue for someone. Most actual php projects autoloaders instead of require statements.
For stereotyped "use" and "use-as" realizations the require_once is
not created.
For stereotyped "use" and "use-as" dependencies the require_once is
not created.
For stereotyped "use" and "use-as" associations the require_once is
not created.
For stereotyped "use" and "use-as" generalizations the require_once is created correctly.
3) Roundtrip PHP:
- Works fine for "use" and "use-as" stereotypes for generalizations.
- Ignores "use" and "use-as" stereotypes for realizations and dependencies.
- I think that roundtrip is treating every association as an attribute, (maybe it needs to check if the attribute in the file is an association in the model?), also not working for "use" and "use-as" associations.
Roundtrip is a great feature, this errors in most cases have no impact or they are easy to fix since the feature does not automatically delete these changes, it's just un mark them and delete the created "unknown" new classes or i.e. the "duplicated" realizations.
4) Provide a way to add documentation to use dependency?
for example:
- Code: Select all
<?php
namespace \Animals\Mammals;
// Feline interface to use on cats.
use \Animals\Mammals\FelineInterface as Feline;
class Cat implements Feline {
// ---
}
In bouml if we add a @{meow} and set the value to "// Feline interface to use on cats." and we add it to the PHP declaration as:
- Code: Select all
@{meow}
${type}
it gets replaced as:
- Code: Select all
<?php
namespace \Animals\Mammals;
use \Animals\Mammals\Feline;
class Cat implements // Feline interface to use on cats.
Feline {
// ---
}
This is not a priority, the same documentation could be written elsewhere by some other means.
Thanks for your time.
Regards,
Federico.
PS: I've edited and drafted this many times so I might write a little nonsense somewhere.