Hello
have you some ideas for this problem?
Thanks you
Le jeudi 5 juin 2014 15:21:30 UTC+2, Gilles Bouchonneau a écrit :
>
> Hello
>
> I have some problems. I don't understand very well.
>
> I tried to load the joined table created by Doctrine with the fixtures.
>
> I think Doctrine don't know how load this table.
>
> Infos:
> ManyToMany Bidirectionnal
> table 1 : post
> table 2 : image
> table 3 : post_image
>
> Post.php (Entity yaml)
>
>> manyToMany:
>>
>> images:
>>
>> targetEntity: Rubens\CoreBundle\Entity\Image
>>
>> cascade: ["persist"]
>>
>> inversedBy: posts
>>
>> joinTable:
>>
>> name: post_image
>>
>> joinColumns:
>>
>> post_id:
>>
>> referencedColumnName: id
>>
>> inverseJoinColumns:
>>
>> image_id:
>>
>> referencedColumnName: id
>>
>>
> Image.php (Entity yaml)
>
>> manyToMany:
>
> posts:
>
> targetEntity: Rubens\CoreBundle\Entity\Post
>
> mappedBy: images
>
>
> postsfixtures.php
>
>> public function load(ObjectManager $manager){
>>
>> $post = new Post();
>>
>> $post->setTitle('Le Lorem Ipsum 7');
>>
>> $post->setSubtitle('test 7');
>>
>> $post->setChapo('Le Lorem Ipsum est simplement du faux texte
>>> employé dans la composition et la mise');
>>
>> $post->setBody('Le Lorem Ipsum est simplement du faux texte
>>> employé dans la composition et la mise en page avant impression. Le Lorem
>>> Ipsum est le faux texte standard de l\'imprimerie depuis les années 1500,
>>> quand un peintre anonyme assembla ensemble des morceaux de texte pour
>>> réaliser un livre spécimen de polices de texte. Il n\'a pas fait que
>>> survivre cinq siècles, mais s\'est aussi adapté à la bureautique
>>> informatique, sans que son contenu n\'en soit modifié. Il a été popularisé
>>> dans les années 1960 grâce à la vente de feuilles Letraset contenant des
>>> passages du Lorem Ipsum, et, plus récemment, par son inclusion dans des
>>> applications de mise en page de texte, comme Aldus PageMaker.');
>>
>> $post->setCreatedAt(new \DateTime('2014-01-02 13:00:09'));
>>
>> $post->setUpdatedAt($post->getCreatedAt());
>>
>> $post->setPublished(true);
>>
>> $post->setPublishedAt($post->getCreatedAt());
>>
>> $post->setEnabledVideo(true);
>>
>>
>>> $this->addReference('post1', $post);
>>
>> $manager->persist($post);
>>
>> $manager->flush();
>>
>>
>>
>> }
>>
>>
>>> public function getOrder() {
>>
>> return 0;
>>
>> }
>>
>>
> imagesfixtures.php
>
>> public function load(ObjectManager $manager){
>
> $image = new Image();
>
> $image->setUrl('bureau-13-02-2010.jpg');
>
> $image->setAlt('Bureau');
>
> $image->setCreatedAt(new \DateTime('2014-01-02 13:00:09'));
>
> $image->setUpdatedAt(new \DateTime('2014-01-02 13:00:09'));
>
>
>> $image->addPost($this->getReference('post1'));
>
>
>> $manager->persist($image);
>
> $manager->flush();
>
> }
>
>
>> public function getOrder() {
>
> return 3;
>
> }
>
>
>
>
> thanks you for your response
>
> Ps: excuse me for my english
>
--
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/d/optout.