FYI, 

I just update the code with the last version of each components : doctrine and 
symfony.

Here how the code is structured :
 - Bundle\PageBundle\Entity\BasePage : a mapped supper class
 - Application\PageBundle\Entity\Page : the entity object (Page extends 
BasePage)

I have defined the mapping in the related xml files and defined the correct 
properties in the BasePage class. Then I run the command `php kooqit/console 
doctrine:generate:entities -v`. The command does not work out of the box, I get 
a 'Every Entity must have an identifier/primary key.'.

I then tweak the code in the DoctrineCommand.php [1]. By doing so, the generate 
entities command works BUT the command generates the getter and the setter in 
the 2 classes. If I delete the extra getter/setter in the Page class and re 
start the command then the extra getter/setter are not generated.


[1] DoctrineCommand.php 

        $entityManagers = $this->getDoctrineEntityManagers();
        foreach ($entityManagers as $key => $em) {
-            $cmf = new DisconnectedClassMetadataFactory();
-            $cmf->setEntityManager($em);

 +           $cmf = $em->getMetadataFactory();
            
            $metadatas = $cmf->getAllMetadata();
            foreach ($metadatas as $metadata) {

                if (strpos($metadata->name, $namespace) === 0) {
                    $bundleMetadatas[$metadata->name] = $metadata;
                }
            }
        }


On 2 déc. 2010, at 21:45, Jonathan Wage wrote:

> Hi,
> 
> We are going to be re-writing the code generation in Doctrine to use a more
> proper tool to do the job so it should be fixed in due time.
> 
> - Jon
> 
> On Tue, Nov 9, 2010 at 7:23 PM, Richard D Shank <[email protected]> wrote:
> 
>> To me it seems like a break down with the mapped superclasses.  I've run
>> into it, got tired of dealing with it and I generate everything by hand now
>> :(.  Actually, with tools in netbeans, its not too painful.
>> 
>> Richard
>> 
>> 
>> On 11/09/2010 05:20 PM, Thomas Rabaix wrote:
>> 
>>> Yes, there is a bug.
>>> 
>>> My understanding is that doctrine:generate:entities command use a specific
>>> Symfony class to load class metadata, whereas schema:update use the one from
>>> doctrine.
>>> 
>>> For now, if I want to update the database schema, I need to comment the
>>> $id definition in the child class, and uncomment the block when I generate
>>> entities.
>>> 
>>> On 8 nov. 2010, at 16:58, Lukas Kahwe Smith wrote:
>>> 
>>> 
>>> 
>>>> On 08.11.2010, at 10:32, c6dney c6dney wrote:
>>>> 
>>>> 
>>>> 
>>>>> Well, I had to generate all entities for my Application Bundle and
>>>>> DoctrineUserBundle separatly.
>>>>> 
>>>>> php app/console doctrine:generate:entities
>>>>> --bundle="Application/MyBundle"
>>>>> 
>>>>> Something strange again:
>>>>> I had to declare a 'Id' attribute to my personal user class
>>>>> "Application\MyBundle\Entity\User.php" because Symfony returns this error:
>>>>> No identifier/primary key specified for Entity
>>>>> "Application\MyBundle\Entity\User.php". Every Entity must have an
>>>>> identifier/primary key  (I can understand this )
>>>>> 
>>>>> Like DoctrineUserBundle readme says, I need to extends its BaseUser clas
>>>>> to create my custom User class, so I used:
>>>>> class User extends BaseUser
>>>>> /**
>>>>> * User id
>>>>> *
>>>>> * @orm:Id
>>>>> * @orm:column(name="id", type="integer")
>>>>> */
>>>>> protected $id;
>>>>> 
>>>>> ...
>>>>> 
>>>>> But when I "update" my schema, another error occurs:
>>>>> php app/console doctrine:schema:update
>>>>> ->  Duplicate definition of column 'id' on entity
>>>>> 'Application\MyBundle\Entity\User' in a field or discriminator column
>>>>> mapping.
>>>>> 
>>>>> - I want to use same attribut name :/
>>>>> 
>>>>> 
>>>> the issue is that there are all sorts of problems when mixing definition
>>>> formats. at least i had the same issue until i ended up using xml across 
>>>> the
>>>> board.
>>>> 
>>>> regards,
>>>> Lukas Kahwe Smith
>>>> [email protected]
>>>> 
>>>> 
>>>> 
>>>> --
>>>> If you want to report a vulnerability issue on symfony, please send it to
>>>> security at symfony-project.com
>>>> 
>>>> You received this message because you are subscribed to the Google
>>>> Groups "symfony developers" group.
>>>> To post to this group, send email to [email protected]
>>>> To unsubscribe from this group, send email to
>>>> [email protected]<symfony-devs%[email protected]>
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/symfony-devs?hl=en
>>>> 
>>>> 
>>> 
>>> 
>> 
>> --
>> If you want to report a vulnerability issue on symfony, please send it to
>> security at symfony-project.com
>> 
>> You received this message because you are subscribed to the Google
>> Groups "symfony developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]<symfony-devs%[email protected]>
>> For more options, visit this group at
>> http://groups.google.com/group/symfony-devs?hl=en
>> 
> 
> 
> 
> -- 
> Jonathan H. Wage
> http://www.twitter.com/jwage
> 
> -- 
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
> 
> You received this message because you are subscribed to the Google
> Groups "symfony developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/symfony-devs?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to