Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6818553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:11:34+00:00 2026-05-26T21:11:34+00:00

This is my code: // my article fixture <?php namespace My\BlogBundle\DataFixtures\ORM; use Doctrine\Common\DataFixtures\AbstractFixture; use

  • 0

This is my code:

// my  article fixture 

<?php

namespace My\BlogBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use My\BlogBundle\Entity\Article;
use My\BlogBundle\Entity\User;
use My\BlogBundle\Entity\Tag;

class ArticleFixtures extends AbstractFixture implements OrderedFixtureInterface
{

    function load($em)
    {
        $article1 = new Article();
        $article1->setCreatedAt(new \Datetime);
        $article1->setTitle('hello my title test');
        $article1->setContent('Lorem ipsum dolor sit amet, consectetur adipiscing eletra electrify denim vel ports.\nLorem ipsum dolor sit ameLorem ipsum dolor sit amet, consectetur adipiscing eletra electrify denim vel ports.\nLorem ipsum dolor sit ameLorem ipsum dolor sit amet, consectetur adipiscing eletra electrify denim vel ports.\nLorem ipsum dolor sit ameLorem ipsum dolor sit amet, consectetur adipiscing eletra electrify denim vel ports.\nLorem ipsum dolor sit ameLorem ipsum dolor sit amet, consectetur adipiscing eletra electrify denim vel ports.\nLorem ipsum dolor sit ame');

        $article1->setUser($em->merge($this->getReference('user-1')) );
        $article1->addTag( $em->merge($this->getReference('tag-1') ) );

        $em->persist($article1);
        $em->flush() ;

    }

    function getOrder()
    {
        return 3 ;  
    }

}



// my tag fixture


<?php

namespace My\BlogBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use My\BlogBundle\Entity\Tag;

class TagFixtures extends AbstractFixture implements OrderedFixtureInterface
{

    function load($em)
    {
        $tag = new Tag();
        $tag->setNom('tagTest') ;

        $em->persist($tag);
        $em->flush();
        $this->addReference('tag-1' ,$tag);


    }

    function getOrder()
    {
        return 2;
    }   

}   

// my user fixtures

<?php

namespace My\BlogBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use My\BlogBundle\Entity\User;

class UserFixtures extends AbstractFixture implements OrderedFixtureInterface
{
    function load($em)
    {
        $user1 = new User() ;
        $user1->setPseudo('xsaidx');
        $user1->setEmail('email@mail.com');
        $user1->setPassword('hah');


        $em->persist($user1);
        $em->flush();
        $this->addReference('user-1' ,$user1);      


    }

    function getOrder()
    {
        return 1 ;
    }

}

But I’m getting this error:

A new entity was found through the relationship ‘My\BlogBundle\Entity\Article#tags’
that was not configured to cascade persist operations for entity: Doctrine\Common\Collections\ArrayCollection@000000003d8f1786000000003709f23. Explicitly persist the new entity or configure cascading persist operations on the relationship. If you cannot find out which entity causes the problem implement ‘My\BlogBundle\Entity\Tag#__toString()’ to get a clue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:11:34+00:00Added an answer on May 26, 2026 at 9:11 pm

    Seems that the tag you are fetching from the line $this->getReference('tag-1') hasn’t been through a $em->persist($tag) its self.

    Either persist your tag first before flushing the entity manager with the tag on the article or you can add cascade={"persist"} to your collection on the Article class and use your current code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use the code in this article that lets you know
i'm trying to use C2DM client with this tutorial:http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html I'm using this code for
I'm trying to use the code from this article: Creating Fake Enums , but
Hey. I'm trying to get this code http://www.codeguru.com/Cpp/W-P/files/inifiles/article.php/c4455/#more to compile under a CLR WinForms
Based on this article : I use this code to make some animation on
This MSDN article stated that: processors are free to reorder this code internal static
I wrote my code using this article at msdn as a primary helper My
I have been playing with the demo code from this msdn article by Jeffrey
I've seen the code examples on this article , but throwing Controller_Exception_404 produces an
this code always returns 0 in PHP 5.2.5 for microseconds: <?php $dt = new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.