How to use an Entity name twice?

0 votes
asked Jul 28, 2014 in Solved by Websmurf (170 points)

I'm getting this error why trying to use an Entity name again:

Model already contains Entity with name [Course]

Where XX is the name of the Entity I'm trying to use.
These entities are not in the same bundle, but share the same name.

How can I get this done in Skipper?

1 Answer

0 votes
answered Jul 28, 2014 by Martin Freki Stradej Skipper developer (74,840 points)
selected Jul 30, 2014 by Martin Freki Stradej
 
Best answer

Currently this is not supported by Skipper, because namespaces are not core attributes and cannot be used for element identification in the Skipper visual model (only the element names are). The change required for the identification of entities by names and namespaces will require complete rewrite of the application logic. Because of this, implementation is not on our short term plan at this moment.

Can you please provide me more detailed example of your intended use? Perhaps we can put together some workaround, but at the moment renaming the entities seems to be the easiest and most straightforward solution.

commented Jul 28, 2014 by Websmurf (170 points)

Hi Martin,

We have a CourseBundle inside our application where customers can create standardized courses (with a name and description).

Thus we've named an entity Course inside this bundle creating the namespace CourseBundle/Course

In our StaffBundle we also define courses where a customer can select which course a staff member has followed and give it an expire date and inputs the results of this followed course. We would like to name this entity Course as well creating StaffBundle/Course to get these results

commented Jul 28, 2014 by Martin Freki Stradej Skipper developer (74,840 points)

Thank you very much for the description. I discussed this with colleagues and at this moment no workaround will be possible. I'm sorry I cannot help you to implement this solution in Skipper.

Usually, using unique entity names is the safest practice, while Doctrine does differentiate between namespaces without problem, this may cause confusion. Having duplicate names is commonly avoided by just renaming the entity, or merging the two tables in question. This can be managed even in larger legacy projects, and usually saves time in the future.

...