[Tip]How to set up a namespace for bundle

0 votes
asked Jul 23, 2014 in How To & Manuals by Martin Freki Stradej Skipper developer (74,840 points)
edited Jul 23, 2014 by Martin Freki Stradej

Hello,
I have been using Skipper for a few days and have added new modules to my project and split a module in order to get a better layout. However I now have some entity that is a parent to entities in other modules. Each time I Export to ORM I need to manually correct the object name to include the full path.

In this application race circuits are children of countries as are race drivers.

In the entity DriverBundle\Entities\NewgtDriver the $country field generated by Skipper does not refer to the Common Bundle:

/**
 * 
 * 
 @ORM\ManyToOne(targetEntity="NewgtCountry", inversedBy="driver")
 @ORM\JoinColumn(name="country_id", referencedColumnName="id")*/
private $country;

And I have to manually edit it:

  /**
     * 
     * 
     @ORM\ManyToOne(targetEntity="\Newgt\CommonBundle\Entity\NewgtCountry", inversedBy="driver")
     @ORM\JoinColumn(name="country_id", referencedColumnName="id")*/
    private $country;

The NewgtCountry associations are defined as follows:

I tried to change the namespace ORM property for the common bundle, but this did not help.
I had hoped to set it to \Newgt\CommonBundle\Entity but I just ended up with some very long entity file names – Newgt.CommonBundle.Entity.NewgtCountry.php

Tried with leading slash
Tried with slashes and backslashes
Tried to find the right page in the manual….

In the end I went back to leaving this blank and manually editing the two (for now) entries to include the full path.

I hope you can point me in the right direction.

Best regards
Steve

1 Answer

0 votes
answered Jul 23, 2014 by Martin Freki Stradej Skipper developer (74,840 points)

This is solved by defining Namespace as ORM properties in the Property editor for the bundle in question:

enter image description here

Once the bundle has its namespace defined, all entities and associations will be exported with the proper namespaces.

...