Hi there !

Ok I succeeded in creating a Repository using your help, and using the
"annotation" type, and modifying the Entities by hand to prepend with
"orm:".
But it is not convenient, and moreover the generated entities are not
complete and are overwrited each time (and not merged, so I lose my
modifications).

I'd rather stick with the yml generation.
I use :
php app/console doctrine:mapping:import MainBundle yml
Then :
php app/console doctrine:generate:entities MainBundle
And :
php app/console doctrine:generate:repositories MainBundle

But that last command is stubborn and keeps skipping my Entities. I
think I have to modify the generated yml files (Resources/config/
doctrine/metadata/orm/Ratethestar.MainBundle.Entity.Member.dcm.yml),
but I could not find tips either in Symfony or Doctrine online
tutorials.

If anyone knows how to modify my yml file in order not to be skipped
during the generate:repositories command, I would love that :)

Here is a sample generated yml file :
Ratethestar\MainBundle\Entity\Member:
  type: entity
  table: member
  fields:
      // and so on


Thanks to all !


On 24 fév, 20:30, olimination <oliminat...@gmail.com> wrote:
> Hi,
>
> I'm not an expert too, but I have managed to configure a working
> custom Repository class for my entity.
> My main problem was, that I have used a incorrect annotation like
> this:
>
> /**
>  * @orm:Entity
>  * @entity(repositoryClass="Laboda\LabodaAdminBundle\Entity
> \WishRepository")
>  */
> class MyEntityName
> { ...
>
> The problem was that I have used only "@entity(repositoryClass=...)"
> instead of "@orm:entity(repositoryClass...)"
>
> And for a correct entity configuration you have to set an "id" or
> primary key field, something like that(in annotation form):
>
> /**
>  * @orm:Entity
>  * @orm:entity(repositoryClass="MyBundle\Entity
> \MyEntityRepositoryClass")
>  */
> class MyEntityName
> {
>     /**
>      * @orm:Id
>      * @orm:Column(type="integer")
>      * @orm:GeneratedValue(strategy="IDENTITY")
>      */
>     protected $id;
> ...
>
> greets,
> Oli
>
> On Feb 24, 8:13 pm, taidehuone <taidehu...@gmail.com> wrote:
>
> > I'm no expert in any way but since I have working repositories I might as
> > well drop a line or two on this.
>
> > Personally I have never called the doctrine:generate:repositories task. I
> > have created the repository files and entity files by hand so that the file
> > structure looks like this. I don't know if this follows the best practices
> > because I might be outdated on that, but it works with the latest master
> > branch version of symfony 2.
>
> > src/Warbler/AccountBundle/Entity/Account.php
> > src/Warbler/AccountBundle/Entity/AccountRepository.php
> > src/Warbler/AccountBundle/Entity/OrganizationAccount.php
> > src/Warbler/AccountBundle/Entity/OrganizationAccountRepository.php
>
> > My Entity definition starts like this:
>
> > <?php
> > namespace Warbler\AccountBundle\Entity;
> > use Symfony\Component\Security\Core\User\AccountInterface;
> > use Symfony\Component\Security\Core\User\AdvancedAccountInterface;
>
> > /**
> >  *
> > @orm:Entity(repositoryClass="Warbler\AccountBundle\Entity\AccountRepository­")
> >  */
> > class Account implements AdvancedAccountInterface
> > {
>
> > }
>
> > And my Repository definition starts like this:
>
> > <?php
> > namespace Warbler\AccountBundle\Entity;
> > use Doctrine\ORM\EntityRepository;
>
> > class AccountRepository extends EntityRepository
> > {
>
> > }

-- 
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 users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to