please read my previous email first. sorry I meant: $class =
$em->getClassMetadata('Entities\users');On Wed, Feb 5, 2014 at 11:20 AM, Nima Sadjadi <[email protected]> wrote: > Thanks for trying to help. Here is what I have in bootstrap for table prefix: > $db_prefix = "prefix_"; > $evm = new Doctrine\Common\EventManager; > $tablePrefix = new Doctrine\ORM\DoctrineExtensions\TablePrefix($db_prefix); > $evm->addEventListener(Doctrine\ORM\Events::loadClassMetadata, $tablePrefix); > and the file: Doctrine\ORM\DoctrineExtensions\TablePrefix.php is > exactly what is given in documentations and it seems that class is > loaded and works fine, but in entity file there is: > $metadata->setPrimaryTable(array( > 'name' => 'prefix_users', > )); > as you see, since prefix is user-defined it should no longer be > hard-coded in entity file and when I change it from prefix_users to > users, it gives table not found error, may be I have to add that the > line below is not in bootstrap but in the file I want to execute the > query: > $class = $em->getClassMetadata('Entities\clients'); > so the eventlistener is called before the line above but if I edit the > line in entity file, removing prefix I get table not found error but > as I said the file TablePrefix.php is called. > please advice how can I import the defined prefix from that > eventlistener into the entity and use it instead of hard-coding the > prefix in entity file? This is all I am trying to do. Again thanks for > help. -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/groups/opt_out.
