GithubHelp home page GithubHelp logo

doctrine / data-fixtures Goto Github PK

View Code? Open in Web Editor NEW
2.8K 2.8K 223.0 695 KB

Doctrine2 ORM Data Fixtures Extensions

Home Page: http://www.doctrine-project.org

License: MIT License

PHP 100.00%
hacktoberfest

data-fixtures's People

Contributors

alcaeus avatar arendjantetteroo avatar bafs avatar beberlei avatar carusogabriel avatar comfortablynumb avatar dbu avatar dependabot[bot] avatar derrabus avatar djlambert avatar greg0ire avatar guilhermeblanco avatar jwage avatar kissifrot avatar l3pp4rd avatar lavoiesl avatar localheinz avatar macnibblet avatar marcbrillault avatar mgirouard avatar mikesimonson avatar nicwortel avatar ocramius avatar peterrehm avatar robocoder avatar spea avatar stephen-lewis avatar stof avatar theofidry avatar vincentlanglet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

data-fixtures's Issues

Data Fixtures version 2.0

Hi guys,

Here is an initial draft for evaluation for the newer version of our data fixtures code.
I'd like people to evaluate and ask whatever questions you may have on this ticket. It is not fully planned, like DependentCalculator requires a Topological sorting to prioritize which fixtures should be loaded first. Same thing for ORMPurger.
Another missing piece is the wish to use Iterators for file loading.
All that aside, the overall engineer of the tool is planned. Please evaluate and provide feedback.

Coding should start in a few days after everybody is satisfied with planned solution. I may update the diagrams during discussions on comments.

Cheers,

Guilherme Blanco

Doctrine\Fixture
Doctrine_Fixture

Doctrine\Fixture\Executor
Doctrine_Fixture_Executor

Doctrine\Fixture\Loader
Doctrine_Fixture_Loader

Doctrine\Fixture\Purger
Doctrine_Fixture_Purger

Doctrine\Fixture\Reference
Doctrine_Fixture_Reference

Doctrine\Fixture\Sorter\Calculator
Doctrine_Fixture_Sorter_Calculator

Doctrine\Fixture\Sorter\Type
Doctrine_Fixture_Sorter_Type

add loadFromFile() method to Doctrine\Common\DataFixtures\Loader

I was trying to load one Fixture file, but I didn't find a way to do this. currently Doctrine\Common\DataFixtures\Loader has only loadFromDirectory() method. we can refactor part of it and put it into another method to allow loading from files.

if you don't have a reason that can stop us from having a loadFromFile() method, just inform me and I will start working on the refactoring and will send you a pull request.

I need this to update DoctrineFixturesBundle to be able to load from files too.

thanks

Data Fixtures will destroy mongodb schema

Hello.

I wrote some fixtures for my app. I'm using mongodb. First I run the following command to prepare my database.

php app/console doctrine:mongodb:schema:create

Created dbs for all classes
Created collections for all classes
Created indexes for all classes

Everything is perfect. Now I want to load my fixtures with the following command.

php app/console doctrine:mongodb:fixtures:load

purging database
loading [1] Acme\DemoBundle\DataFixtures\MongoDB\LoadUserData
loading [2] Acme\DemoBundle\DataFixtures\MongoDB\LoadClientData

If I check my database schema, all fixtures are loaded successfully, but my indexes are dropped and this will result in a wrong behavior at database save statements.

I've to execute the command php app/console doctrine:mongodb:schema:create again and all indexes are back.

Is there a way to fix this? My fixtures are straight forward copy & paste from the documentation, no specials, no extras.

I'm using the dev-master version of both components.

"doctrine/data-fixtures": "dev-master",
"doctrine/doctrine-fixtures-bundle": "dev-master"

Cheers.

Order by fixture's "parent" classes

Hi,

I've been working on an implementation of fixtures ordering. Basically, it lets you return from a fixture an array of fixture classes it depends on. I needed this because I'm working on an app with lots of modules. Some modules are mandatories, and some are not. So using numbers wasn't comfortable for me.

This implementation detects circular references too. This algorithm is based on this one:

http://database-programmer.blogspot.com/2008/08/advanced-algorithm-sequencing.html

NOTE: You can use only one ordering method: number based or parent based. Not both. It will decide which to use based on the last interface analized on the last addFixture call.

I'd like to have your opinions about this. If you like this implementation, I'll create a PR:

https://github.com/comfortablynumb/data-fixtures/tree/order-by-parent-class

Thanks in advance.

Truncating table with foreign keys fails

When I am calling symfony CLI command:

php app/console doctrine:fixtures:load

I get

[PDOException] 

SQLSTATE[42000]: Syntax error or access violation: 1701 Cannot truncate a table referenced in a foreign key constraint (symfony.param_product, CONSTRAINT param_product_ibfk_1 FOREIGN KEY (param_val_id) REFERENCES symfony.param_value (id))

Table symfony.param_product is created by @Orm\JoinTable annotation (with @Orm\ManyToMany). I am using MySQL

This worked fine before this change: 91ff6eb

I thought it might be bug on my side (e.g. no onDelete options) but everything I tried failed.

As far as I learned e.g. from http://forums.asp.net/t/1283840.aspx/1?How+can+I+truncate+the+table+which+have+foreign+key+

 ON DELETE CASCADE is true only for deleting records and not for truncating tables.

 You have to drop the foreign key constraint from Child Table that references the Master Table to be truncated, then after only you are able to truncate the Master Table. 

So it seems to me the only solution is to use DELETE or drop the foregin keys first.

Can we revert the 91ff6eb change to fix this problem? @beberlei?

Support truncating tables with foreign keys

I had to override the loadFixtures method of the LiipFunctionalTestBundle with this stuff to avoid blowing up mysql:

    protected function loadFixtures(array $classNames, $omName = null, $registryName = 'doctrine', $purgeMode = null)
    {
        $conn = $this->getContainer()->get($registryName)->getManager()->getConnection();
        $db = $conn->getDriver()->getDatabasePlatform()->getName();
        if ($db === 'mysql') {
            $conn->exec('SET FOREIGN_KEY_CHECKS=0');
        }
        $res = parent::loadFixtures($classNames, $omName, $registryName, $purgeMode);
        if ($db === 'mysql') {
            $conn->exec('SET FOREIGN_KEY_CHECKS=1');
        }

        return $res;
    }

Now obviously it could be integrated in the bundle (cc @lsmith77) but ideally it would be part of this library itself so everyone benefits. Not sure how/where to best do this though, so I'm dropping this here hoping someone will pick it up :)

Fail with self reference constraints

Fixtures load fail when is trying to purge a table with self reference foreign key

[PDOException]                                                                                                                                                                                                                              
  SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`app`.`place`, CONSTRAINT `FK_B5DZ7CC17T7XCA70` FOREIGN KEY (`parent_id`) REFERENCES `place` (`id`)) 

Compound ids trip up the ProxyReferenceRepository

I have a class that has two identifier fields (a numeric id and a user ManyToOne) so that every user has their own sequence of numeric ids. This causes failures together with the liip functional test bundle when reloading a sqlite DB from cache I believe.

Here is a stack trace:

Array to string conversion

vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php:2899
vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php:512
app\cache\test\jms_diextra\doctrine\EntityManager_531d8d621ddd2.php:240
vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\ProxyReferenceRepository.php:97
vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\ProxyReferenceRepository.php:123 vendor\liip\functional-test-bundle\Liip\FunctionalTestBundle\Test\WebTestCase.php:274

The ProxyReferenceRepository's serialize and unserialize methods don't deal with non-numeric ids it seems.

Relates to 8ffac1c kinda.

If I dump the $proxyReference at line 91 it is like this:

array(2) {
  [0] =>
  string(32) "Entity\Object"
  [1] =>
  array(2) {
    'id' =>
    int(1)
    'parent' =>
    array(3) {
      '__initializer__' =>
      array(0) {
        ...
      }
      '__cloner__' =>
      array(0) {
        ...
      }
      '__isInitialized__' =>
      bool(false)
    }
  }
}

/cc @guilhermeblanco

Add packagist service hook

So that new commits are referenced more quickly. Currently I'm still cloning things of 2 commits ago where something is broken.

Tests not working ?

I've followed the instruction "Running the tests" in README.md but I got "maximum nesting level reached" error. It keeps calling this: Doctrine\Common\DataFixtures\Loader->addFixture() . I've tried increasing the limit but stopped at 2000 and I was still getting the error.

Loader::loadFromDirectory iterates over directory dots

Error message from symfony2 (revision c0dc01d9b913dacbf75b) console executing "doctrine:data:load":

Fatal error: Doctrine\Common\DataFixtures\Loader::loadFromDirectory(): Failed opening required '/var/www/webconsole/src/Application/AccountBundle/DataFixtures' (include_path='/var/www/webconsole/src/vendor/swiftmailer/lib:.:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/share/pear') in /home/martijn/Projects/3rd-party/doctrine-data-fixtures/lib/Doctrine/Common/DataFixtures/Loader.php on line 0

Patch: http://github.com/martijn4evers/data-fixtures/commit/56897bec024d7eacc59d9edf84b30973906bd166

ProxyReferenceRepository fatal error when serializing object without getId() method

I'm using doctrine/data-fixtures as part of using ICBaseTestBundle. I'm using ICBaseTestBundle's getFixtureList() functionality to load some fixtures prior to executing a test case.

The entity whose fixtures I'm loading does not have a getId() method because my primary key field is mapped to another property (e.g. private $code; instead of private $id;), so it doesn't make sense to expose a getId() method because that means nothing to my entity.

Could ProxyReferenceRepository use another way to find the primary key(s) used by the given entity (maybe via UOW) instead of calling getId()?

On a slightly related note, I was going to try writing a failing test for this but ran into the test suite exhausting available memory above memory_limit=2G on test Doctrine\Tests\Common\DataFixtures\DependentFixtureTest::test_orderFixturesByDependencies_circularReferencesMakeMethodThrowCircularReferenceException using PHPUnit 3.7.9 installed via PEAR w/o xDebug. PHPUnit 3.7.14 installed via composer had issues with using Composer dev-master's autoloader.

Issue exists as of eef10f6
Issue appears to occur here:

$simpleReferences[$name] = array($className, $reference->getId());

How to Get Reference

Hi,

I have one ORM and one MongoDB fixture in order.
Could anyone let me know how to get a reference of ORM fixture (for example ID of the object) into MongoDB fixture?

Thanks

[RFC] Use multiple transactions during ORM executor execute()

I'm using lifecycle callbacks to set a default value to a field using an entity got from the db, as https://github.com/doctrine/data-fixtures/blob/master/lib/Doctrine/Common/DataFixtures/Executor/ORMExecutor.php#L75 all the fixtures are loaded in a single commit, this breaks my lifecycle callbacks since the db is not filled with the default data got from another fixture before persisting the entity.

I've fixed this on my repo by using:

public function execute(array $fixtures, $append = false, $singleTransaction = true)
{
    $executor = $this;
    if ($singleTransaction) {
        $this->em->transactional(function(EntityManager $em) use ($executor, $fixtures, $append) {
            if ($append === false) {
                $executor->purge();
            }
            foreach ($fixtures as $fixture) {
                $executor->load($em, $fixture);
            }
        });
    } else {
        if ($append === false) {
            $executor->purge();
        }
        foreach ($fixtures as $fixture) {
            $executor->load($this->em, $fixture);
        }
    }
}

which has the problem to break the abstract since only ORM uses transactions or maybe we can add another function to internally set wherever to use a single transaction or not.

Would this be a nice feature to add?

Recreate database from backup

Several libraries, such as LiipFunctionalTestBundle, h4ccAliceFixturesBundle and VIPSoft DoctrineDataFixturesExtension, provide their own implementation of:

  • recreating the database between tests
  • restoring the database from a backup, e.g. by copying a file (for SQLite) or doing a mysqldump (for MySQL)

Would this functionality be in the scope of doctrine/data-fixtures? If so, I would be willing to extract the implementations and add them here. We can then try to convince the separate implementors to use the โ€˜officialโ€™ one instead, which will ease future maintainability. What do you think?

doctrine:fixtures:load Fails One-To-Many, Self-referencing

class DescriptionArea
{ 
//..
/**
* @ORM\OneToMany(targetEntity="DescriptionArea", mappedBy="parent")
*/
protected $descriptionAreas;

/**
 * @ORM\ManyToOne(targetEntity="DescriptionArea", inversedBy="descriptionAreas")
 */
protected $parent;
//..
}

Throw error:

[Doctrine\DBAL\DBALException]
An exception occurred while executing 'DELETE FROM prefix_DescriptionArea':
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (sigtec_dev.prefix_DescriptionArea,
CONSTRAINT FK_7265873E727ACA70 FOREIGN KEY (parent_id) REFERENCES prefix_DescriptionArea (id))

Before running the query should delete the index when the table has self-reference.

Symfony2 fails to manage multiple connections and relationships between different bundles

EDIT: Assetic has changed its path, so you can remove assetic tags from app/config/config.yml and app/config/config_dev.yml to get rid of the error.

Hi,

i'm writting this thread in order to detail the full story about what's happening to me when working with multiple connections.

I have an Oracle database which is accessed by OracleBundle through oracle connection, then i have a MySQL database which is accessed by MySQLBundle using mysql connection. Inside MySQLBundle i have an entity which tries to store, as FK, a field which belongs to another entity which resides inside OracleBundle. AFAIK it can't be done by Symfony2, but in the testing process and before linking each entity with each other, so there are no FK to link each entity, while creating the above ( http://www.2shared.com/file/2u4GhFVX/SymfonyTestCasetar.html ) "project" i noticed doctrine bundle can't manage multiple connections properly.

What's happening to me when working with multiple connections? If you download the tar.gz file you could see there is a FooBundle and a BarBundle, each one using its own connection an of course each own entity manager. Inside FooBundle there is Foo entity and inside Bar Bundle there is Bar entity, each one has each fixture to load some info to the database. The issue i'm talking about appears here when trying to load the fixtures.

**First i create both databases, each one using each own entity manage so also using each own connection:
php ./symfony doctrine:database:drop --connection="bar" --force'
php ./symfony doctrine:database:drop --connection="foo" --force'
php ./symfony doctrine:database:create --connection="bar"
php ./symfony doctrine:database:create --connection="foo"

**Then i successfully create the schema:
php ./symfony doctrine:schema:create --em="bar"
php ./symfony doctrine:schema:create --em="foo"

**And finally i try to load the fixtures which throughs me an error:
php ./symfony doctrine:fixtures:load --em="foo"
php ./symfony doctrine:fixtures:load --em="bar"

**That's the error i get, so i think Symfony has some kind of bug:
Created database for connection named bar
Created database for connection named foo
ATTENTION: This operation should not be executed in a production environment.

Creating database schema...
Database schema created successfully!
ATTENTION: This operation should not be executed in a production environment.

Creating database schema...
Database schema created successfully!

purging database
loading myVendor\myFooBundleBundle\DataFixtures\ORM\Foo_
loading myVendor\myBarBundleBundle\DataFixtures\ORM\Bar_

[Doctrine\ORM\Mapping\MappingException]
Class myVendor\myBarBundleBundle\Entity\Bar is not a valid entity or mapped super class.

doctrine:fixtures:load [--fixtures[="..."]] [--append] [--em="..."] [--purge-with-truncate]

purging database
loading myVendor\myFooBundleBundle\DataFixtures\ORM\Foo_
[Doctrine\ORM\Mapping\MappingException]
Class myVendor\myFooBundleBundle\Entity\Foo is not a valid entity or mapped super class.

doctrine:fixtures:load [--fixtures[="..."]] [--append] [--em="..."] [--purge-with-truncate]

**But if i randomly remove a fixture, no matter which one, everything runs fine:
mv src/myVendor/myBarBundleBundle/DataFixtures/ORM/Bar.php /tmp/
php ./symfony doctrine:fixtures:load --em="foo"

purging database
loading myVendor\myFooBundleBundle\DataFixtures\ORM\Foo

**But when both fixtures exists:
mv /tmp/Bar.php src/myVendor/myBarBundleBundle/DataFixtures/ORM/
php ./symfony doctrine:fixtures:load --em="foo"

purging database
loading myVendor\myFooBundleBundle\DataFixtures\ORM\Foo
loading myVendor\myBarBundleBundle\DataFixtures\ORM\Bar_

[Doctrine\ORM\Mapping\MappingException]
Class myVendor\myBarBundleBundle\Entity\Bar is not a valid entity or mapped super class.

AbstractExecutor::__construct() must be an instance of Doctrine\Common\Persistence\ObjectManager

Hello, getting this error. I'm assuming I have an outdated Doctrine2 install, as my EntityManager does not inherit from ObjectManager, and therefore these lines cannot ever be correct..

//in app

//Entity Manager
$em = $registry->entitymanager;

//pass EM to ORMExecutor
$purger = new ORMPurger();
$executor = new ORMExecutor($em, $purger);

//ORMExecutor.php (extends AbstractExecutor)
parent::__construct($em);

//AbstractExecutor
public function __construct(ObjectManager $manager)

EntityManager isn't an ObjectManager. What am I missing please. DOctrne Common version is 2.0.0RC1-DEV

Thanks

Assign ID value within referenced Fixture and GeneratedValue(strategy="AUTO")

If @ORM\GeneratedValue(strategy="AUTO") is used in an entity loaded by a fixture, the ID can't be set manually.

Trying to set it like this will ignore the assigned ID

class TestData extends AbstractFixture {

const IDVALUE = 125;

public function load(ObjectManager $manager)
{
    ...
    $entity->setId(self::IDVALUE);
    ...
}

Trying to set it like this will result in the following error

Doctrine\ORM\ORMInvalidArgumentException: A new entity was found through the relationship
class TestData extends AbstractFixture {

const IDVALUE = 125;

public function load(ObjectManager $manager)
{
    ...
    $entity->setId(self::IDVALUE);
    ...
    // Explicity set ID
    $metadata = $manager->getClassMetaData(get_class($user));
    $metadata->setIdGenerator(new AssignedGenerator());
    ....
}

If @ORM\GeneratedValue(strategy="AUTO") is removed from the entity, the first code works perfect, but the isn't generated in the database anymore.

How can I achieve to set the ID value in a fixture for unit testing but getting it generated in the database for the application code?

Enable doctrine:fixtures:load --env option

Currently there is now way to load fixtures for other environments. It would be nice if we could could load fixtures into a DB as specified by the environment specific configuration.

Evaluate xi-fixtures for integration or assimilation

Data fixtures does a good job of providing inheritable static fixtures. I've implemented an alternative, factory-based approach in Xi Fixtures, which I've found to often be more flexible and less fragile than static fixtures. It's essentially a FactoryGirl clone for Doctrine.

Is this relevant to your interests? Do you feel the projects should merge? Or maybe just mention each other in their readmes?

ORMExecutor wraps all fixtures in a single transaction

Hello,

So I have a situation where the current executor can't load my fixtures. I have three fixture files. The third one loaded has an entity that has a custom id generator. The id generator is based of an incrementing value in objects in the first fixture.

The current executor is

public function execute(array $fixtures, $append = false)
{
        $executor = $this;
        $this->em->transactional(function(EntityManager $em) use ($executor, $fixtures, $append) {
            if ($append === false) {
                $executor->purge();
            }
            foreach ($fixtures as $fixture) {
                $executor->load($em, $fixture);
            }
        });
}

I've used a couple of different machines with this, once got a segfault other times got other php fatal errors - don't have all of them at the moment but can dig up specific issues if necessary. In any case I'm wondering why the entire fixture loading is in one transaction. When I change that execute to

public function execute(array $fixtures, $append = false)
{
    if ($append === false) {
        $this->purge();
    }
    foreach ($fixtures as $fixture) {
        $this->em->beginTransaction();
        $this->load($this->em, $fixture);
        $this->em->commit();
    }
}

My fixtures load.

So I'm not sure why the entire process needs to be one transaction as opposed to a transaction per fixture file. Thoughts?

Idea: No Access to Entity Manager from Fixtures

Dependency on Entity Manager

Currently, entity manager instance is passed to fixtures. A fixture in its turn uses the entity manager to persist and flush entities created by it. Correct me if I'm wrong, the only purpose of explicit persistence is to acquire identifier value. However, Doctrine entities do not operate identifiers, references between objects in memory define relations.

For example, a fixture declared in the current paradigm:

class LoadUserRoleData extends AbstractFixture
{
    public function load(ObjectManager $manager)
    {
        $adminRole = new Role();
        $adminRole->setName('admin');

        $anonymousRole = new Role;
        $anonymousRole->setName('anonymous');

        $manager->persist($adminRole);
        $manager->persist($anonymousRole);
        $manager->flush();

        $this->addReference('admin-role', $adminRole);
    }
}

Solution

The idea is that fixtures return entity objects, which are intended to be persisted. The fixtures framework collects all returned entities, persists them and flushes the entity manager. In result, there is no necessity to allow access to the entity manager from fixtures. For example:

class LoadUserRoleData extends AbstractFixture
{
    public function load()
    {
        $adminRole = new Role();
        $adminRole->setName('admin');

        $anonymousRole = new Role;
        $anonymousRole->setName('anonymous');

        $this->addReference('admin-role', $adminRole);

        return array($adminRole, $anonymousRole);
    }
}

Inheritance from Abstract Fixture Class

Another problem of the current paradigm is necessity to inherit the abstract fixture class to gain access to the references repository. The proposed approach allows to give names to fixture entities that are intended to be shared. That basically allows to eliminate dependency on the reference repository for fixtures, which only share their entities, but not use already shared ones. For example:

class LoadUserRoleData
{
    public function load()
    {
        $adminRole = new Role();
        $adminRole->setName('admin');

        $anonymousRole = new Role;
        $anonymousRole->setName('anonymous');

        return array('admin-role' => $adminRole, $anonymousRole);
    }
}

In order to retrieve shared entities, access to some sort of registry is still needed. One of the options is to provide access to the repository as part of DependentFixtureInterface, for example:

interface DependentFixtureInterface
{   
    public function getDependencies();

    public function injectDependencies(ReferenceRepository $dependencies);
}

class LoadUserData implements DependentFixtureInterface
{
    protected $_adminRole;

    public function getDependencies()
    {
        return array('MyDataFixtures\LoadUserRoleData');
    }

    public function injectDependencies(ReferenceRepository $dependencies)
    {
        $this->_adminRole = $dependencies->getReference('admin-role');
    {

    public function load()
    {
        $user = new User();
        $user->setUsername('jwage');
        $user->setPassword('test');
        $user->setRole($this->_adminRole);

        return array('admin-user' => $user);
    }
}

Impossible to Customize Fixture Creation

Currently, fixtures instantiation is hard-coded in Doctrine\Common\DataFixtures\Loader to use the new operator. That prevents usage of widely-adopted practices of injecting dependencies on constructor.

Suggested solution: delegate fixtures creation to a factory and provide a machanism to pass the custom factory to the fixtures framework.

Command line

How i use this in command line???

Because in houdog/data-fixture i used in command line like this:
vendo/bin/doctrine-module data-fixture:import

Scalar type of property in created entity and loaded - different

I have entity:

class myEntity
{
    /**
     * @var float
     *
     * @ORM\Column(type="decimal", precision=2, scale=2)
     */
    protected $vat;
}

I creating mine fixtures:

class LoadMyEntityData extends AbstractFixture
{
    /**
     * {@inheritdoc}
     */
    public function load(ObjectManager $manager)
    {
        $svStore = new myEntity('sv');
        $svStore->setVat(0.25);
    }
}

And when i try to use this myEntity elsewhere it raise

[Doctrine\ORM\ORMInvalidArgumentException]                                                                                                                                                            
  A new entity was found through the relationship '***\CommonBundle\Entity\OtherEntity#myEntity that was not configured to cascade persist operations for entity: ***\CommonBundle\Entity  
  \myEntity@000000007756d44c0000000069156ecd. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist  this association in the mapping fo  
  r example @ManyToOne(..,cascade={"persist"}). If you cannot find out which entity causes the problem implement '***\CommonBundle\Entity\myEntity#__toString()' to get a clue.    

I found problem in type of parameter. It switch from float to string. Doctrine return myEntity::vat string.

MongoDB indexes are deleted on executing fixtures.

I just noticed that executing fixtures without the append option deletes all indexes from the database. I don't know if this behavior is intentional, but it would be nice not to have to execute "odm:schema:create --index" every time i load fixtures.

Broken unit tests: Circular Reference

Tried with nesting level 1000, put it at 50 to get smaller stacktrace.

PHPUnit 3.7.35 by Sebastian Bergmann.

Configuration read from C:\inetpub\symfony23\vendor\doctrine\data-fixtures\phpunit.xml.dist

..
Fatal error: Maximum function nesting level of '50' reached, aborting! in C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php on line 129

Call Stack:
    0.0000     123960   1. {main}() C:\inetpub\symfony23\vendor\phpunit\phpunit\composer\bin\phpunit:0
    0.0070     530056   2. PHPUnit_TextUI_Command::main(???) C:\inetpub\symfony23\vendor\phpunit\phpunit\composer\bin\phpunit:63
    0.0070     530384   3. PHPUnit_TextUI_Command->run(array (0 => 'C:\\inetpub\\symfony23\\bin\\/../vendor/phpunit/phpunit/composer/bin/phpunit'), TRUE) C:\inetpub\symfony23\vendor\phpunit\phpunit\PHPUnit\TextUI\Command.php:129
    0.1470    2194680   4. PHPUnit_TextUI_TestRunner->doRun(class PHPUnit_Framework_TestSuite { protected $backupGlobals = FALSE; protected $backupStaticAttributes = NULL; protected $name = 'Doctrine Data Fixtures Test Suite'; protected $groups = array ('Gustavo Adrian <[email protected]>' => array (...), 'Gediminas Morkevicius <[email protected]>' => array (...), 'Jonathan H. Wage <[email protected]>' => array (...), 'Anthon Pang <[email protected]>' => array (...)); protected $tests = array (0 => class PHPUnit_Framework_TestSuite { ... }, 1 => class PHPUnit_Framework_TestSuite { ... }, 2 => class PHPUnit_Framework_TestSuite { ... }, 3 => class PHPUnit_Framework_TestSuite { ... }, 4 => class PHPUnit_Framework_TestSuite { ... }, 5 => class PHPUnit_Framework_TestSuite { ... }, 6 => class PHPUnit_Framework_TestSuite { ... }, 7 => class PHPUnit_Framework_TestSuite { ... }); protected $numTests = 23; protected $testCase = FALSE }, array ('listGroups' => FALSE, 'loader' => NULL, 'useDefaultConfiguration' => TRUE, 'testSuffixes' => array (0 => 'Test.php', 1 => '.phpt'), 'configuration' => 'C:\\inetpub\\symfony23\\vendor\\doctrine\\data-fixtures\\phpunit.xml.dist')) C:\inetpub\symfony23\vendor\phpunit\phpunit\PHPUnit\TextUI\Command.php:176
    0.1510    2372560   5. PHPUnit_Framework_TestSuite->run(class PHPUnit_Framework_TestResult { protected $passed = array ('Doctrine\Tests\Common\DataFixtures\DependentFixtureTest::test_orderFixturesByDependencies_orderClassesWithASingleParent' => array (...), 'Doctrine\Tests\Common\DataFixtures\DependentFixtureTest::test_orderFixturesByDependencies_orderClassesWithAMultipleParents' => array (...)); protected $errors = array (); protected $deprecatedFeatures = array (); protected $failures = array (); protected $notImplemented = array (); protected $skipped = array (); protected $listeners = array (0 => class PHPUnit_TextUI_ResultPrinter { ... }, 1 => class PHPUnit_Util_DeprecatedFeature_Logger { ... }); protected $runTests = 3; protected $time = 0.0080010890960693; protected $topTestSuite = class PHPUnit_Framework_TestSuite { protected $backupGlobals = FALSE; protected $backupStaticAttributes = NULL; protected $name = 'Doctrine Data Fixtures Test Suite'; protected $groups = array (...); protected $tests = array (...); protected $numTests = 23; protected $testCase = FALSE }; protected $codeCoverage = NULL; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $strictMode = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; protected $timeoutForSmallTests = 1; protected $timeoutForMediumTests = 10; protected $timeoutForLargeTests = 60 }, FALSE, array (), array (), FALSE) C:\inetpub\symfony23\vendor\phpunit\phpunit\PHPUnit\TextUI\TestRunner.php:346
    0.1510    2373408   6. PHPUnit_Framework_TestSuite->run(class PHPUnit_Framework_TestResult { protected $passed = array ('Doctrine\Tests\Common\DataFixtures\DependentFixtureTest::test_orderFixturesByDependencies_orderClassesWithASingleParent' => array (...), 'Doctrine\Tests\Common\DataFixtures\DependentFixtureTest::test_orderFixturesByDependencies_orderClassesWithAMultipleParents' => array (...)); protected $errors = array (); protected $deprecatedFeatures = array (); protected $failures = array (); protected $notImplemented = array (); protected $skipped = array (); protected $listeners = array (0 => class PHPUnit_TextUI_ResultPrinter { ... }, 1 => class PHPUnit_Util_DeprecatedFeature_Logger { ... }); protected $runTests = 3; protected $time = 0.0080010890960693; protected $topTestSuite = class PHPUnit_Framework_TestSuite { protected $backupGlobals = FALSE; protected $backupStaticAttributes = NULL; protected $name = 'Doctrine Data Fixtures Test Suite'; protected $groups = array (...); protected $tests = array (...); protected $numTests = 23; protected $testCase = FALSE }; protected $codeCoverage = NULL; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $strictMode = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; protected $timeoutForSmallTests = 1; protected $timeoutForMediumTests = 10; protected $timeoutForLargeTests = 60 }, FALSE, array (), array (), FALSE) C:\inetpub\symfony23\vendor\phpunit\phpunit\PHPUnit\Framework\TestSuite.php:705
    0.1630    2593216   7. PHPUnit_Framework_TestSuite->runTest(class Doctrine\Tests\Common\DataFixtures\DependentFixtureTest { protected $backupGlobals = FALSE; protected $backupGlobalsBlacklist = array (); protected $backupStaticAttributes = NULL; protected $backupStaticAttributesBlacklist = array (); protected $runTestInSeparateProcess = FALSE; protected $preserveGlobalState = TRUE; private ${PHPUnit_Framework_TestCase}:inIsolation = FALSE; private ${PHPUnit_Framework_TestCase}:data = array (); private ${PHPUnit_Framework_TestCase}:dataName = ''; private ${PHPUnit_Framework_TestCase}:useErrorHandler = NULL; private ${PHPUnit_Framework_TestCase}:useOutputBuffering = NULL; private ${PHPUnit_Framework_TestCase}:expectedException = 'Doctrine\\Common\\DataFixtures\\Exception\\CircularReferenceException'; private ${PHPUnit_Framework_TestCase}:expectedExceptionMessage = ''; private ${PHPUnit_Framework_TestCase}:expectedExceptionCode = NULL; private ${PHPUnit_Framework_TestCase}:required = array ('PHP' => NULL, 'PHPUnit' => NULL, 'functions' => array (...), 'extensions' => array (...)); private ${PHPUnit_Framework_TestCase}:name = 'test_orderFixturesByDependencies_circularReferencesMakeMethodThrowCircularReferenceException'; private ${PHPUnit_Framework_TestCase}:dependencies = array (); private ${PHPUnit_Framework_TestCase}:dependencyInput = array (); private ${PHPUnit_Framework_TestCase}:iniSettings = array (); private ${PHPUnit_Framework_TestCase}:locale = array (); private ${PHPUnit_Framework_TestCase}:mockObjects = array (); private ${PHPUnit_Framework_TestCase}:status = NULL; private ${PHPUnit_Framework_TestCase}:statusMessage = ''; private ${PHPUnit_Framework_TestCase}:numAssertions = 0; private ${PHPUnit_Framework_TestCase}:result = class PHPUnit_Framework_TestResult { protected $passed = array (...); protected $errors = array (...); protected $deprecatedFeatures = array (...); protected $failures = array (...); protected $notImplemented = array (...); protected $skipped = array (...); protected $listeners = array (...); protected $runTests = 3; protected $time = 0.0080010890960693; protected $topTestSuite = class PHPUnit_Framework_TestSuite { ... }; protected $codeCoverage = NULL; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $strictMode = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; protected $timeoutForSmallTests = 1; protected $timeoutForMediumTests = 10; protected $timeoutForLargeTests = 60 }; private ${PHPUnit_Framework_TestCase}:testResult = NULL; private ${PHPUnit_Framework_TestCase}:output = ''; private ${PHPUnit_Framework_TestCase}:outputExpectedRegex = NULL; private ${PHPUnit_Framework_TestCase}:outputExpectedString = NULL; private ${PHPUnit_Framework_TestCase}:hasPerformedExpectationsOnOutput = FALSE; private ${PHPUnit_Framework_TestCase}:outputCallback = FALSE; private ${PHPUnit_Framework_TestCase}:outputBufferingActive = TRUE }, class PHPUnit_Framework_TestResult { protected $passed = array ('Doctrine\Tests\Common\DataFixtures\DependentFixtureTest::test_orderFixturesByDependencies_orderClassesWithASingleParent' => array (...), 'Doctrine\Tests\Common\DataFixtures\DependentFixtureTest::test_orderFixturesByDependencies_orderClassesWithAMultipleParents' => array (...)); protected $errors = array (); protected $deprecatedFeatures = array (); protected $failures = array (); protected $notImplemented = array (); protected $skipped = array (); protected $listeners = array (0 => class PHPUnit_TextUI_ResultPrinter { ... }, 1 => class PHPUnit_Util_DeprecatedFeature_Logger { ... }); protected $runTests = 3; protected $time = 0.0080010890960693; protected $topTestSuite = class PHPUnit_Framework_TestSuite { protected $backupGlobals = FALSE; protected $backupStaticAttributes = NULL; protected $name = 'Doctrine Data Fixtures Test Suite'; protected $groups = array (...); protected $tests = array (...); protected $numTests = 23; protected $testCase = FALSE }; protected $codeCoverage = NULL; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $strictMode = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; protected $timeoutForSmallTests = 1; protected $timeoutForMediumTests = 10; protected $timeoutForLargeTests = 60 }) C:\inetpub\symfony23\vendor\phpunit\phpunit\PHPUnit\Framework\TestSuite.php:745
    0.1630    2593216   8. PHPUnit_Framework_TestCase->run(class PHPUnit_Framework_TestResult { protected $passed = array ('Doctrine\Tests\Common\DataFixtures\DependentFixtureTest::test_orderFixturesByDependencies_orderClassesWithASingleParent' => array (...), 'Doctrine\Tests\Common\DataFixtures\DependentFixtureTest::test_orderFixturesByDependencies_orderClassesWithAMultipleParents' => array (...)); protected $errors = array (); protected $deprecatedFeatures = array (); protected $failures = array (); protected $notImplemented = array (); protected $skipped = array (); protected $listeners = array (0 => class PHPUnit_TextUI_ResultPrinter { ... }, 1 => class PHPUnit_Util_DeprecatedFeature_Logger { ... }); protected $runTests = 3; protected $time = 0.0080010890960693; protected $topTestSuite = class PHPUnit_Framework_TestSuite { protected $backupGlobals = FALSE; protected $backupStaticAttributes = NULL; protected $name = 'Doctrine Data Fixtures Test Suite'; protected $groups = array (...); protected $tests = array (...); protected $numTests = 23; protected $testCase = FALSE }; protected $codeCoverage = NULL; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $strictMode = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; protected $timeoutForSmallTests = 1; protected $timeoutForMediumTests = 10; protected $timeoutForLargeTests = 60 }) C:\inetpub\symfony23\vendor\phpunit\phpunit\PHPUnit\Framework\TestSuite.php:775
    0.1630    2593216   9. PHPUnit_Framework_TestResult->run(class Doctrine\Tests\Common\DataFixtures\DependentFixtureTest { protected $backupGlobals = FALSE; protected $backupGlobalsBlacklist = array (); protected $backupStaticAttributes = NULL; protected $backupStaticAttributesBlacklist = array (); protected $runTestInSeparateProcess = FALSE; protected $preserveGlobalState = TRUE; private ${PHPUnit_Framework_TestCase}:inIsolation = FALSE; private ${PHPUnit_Framework_TestCase}:data = array (); private ${PHPUnit_Framework_TestCase}:dataName = ''; private ${PHPUnit_Framework_TestCase}:useErrorHandler = NULL; private ${PHPUnit_Framework_TestCase}:useOutputBuffering = NULL; private ${PHPUnit_Framework_TestCase}:expectedException = 'Doctrine\\Common\\DataFixtures\\Exception\\CircularReferenceException'; private ${PHPUnit_Framework_TestCase}:expectedExceptionMessage = ''; private ${PHPUnit_Framework_TestCase}:expectedExceptionCode = NULL; private ${PHPUnit_Framework_TestCase}:required = array ('PHP' => NULL, 'PHPUnit' => NULL, 'functions' => array (...), 'extensions' => array (...)); private ${PHPUnit_Framework_TestCase}:name = 'test_orderFixturesByDependencies_circularReferencesMakeMethodThrowCircularReferenceException'; private ${PHPUnit_Framework_TestCase}:dependencies = array (); private ${PHPUnit_Framework_TestCase}:dependencyInput = array (); private ${PHPUnit_Framework_TestCase}:iniSettings = array (); private ${PHPUnit_Framework_TestCase}:locale = array (); private ${PHPUnit_Framework_TestCase}:mockObjects = array (); private ${PHPUnit_Framework_TestCase}:status = NULL; private ${PHPUnit_Framework_TestCase}:statusMessage = ''; private ${PHPUnit_Framework_TestCase}:numAssertions = 0; private ${PHPUnit_Framework_TestCase}:result = class PHPUnit_Framework_TestResult { protected $passed = array (...); protected $errors = array (...); protected $deprecatedFeatures = array (...); protected $failures = array (...); protected $notImplemented = array (...); protected $skipped = array (...); protected $listeners = array (...); protected $runTests = 3; protected $time = 0.0080010890960693; protected $topTestSuite = class PHPUnit_Framework_TestSuite { ... }; protected $codeCoverage = NULL; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $strictMode = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; protected $timeoutForSmallTests = 1; protected $timeoutForMediumTests = 10; protected $timeoutForLargeTests = 60 }; private ${PHPUnit_Framework_TestCase}:testResult = NULL; private ${PHPUnit_Framework_TestCase}:output = ''; private ${PHPUnit_Framework_TestCase}:outputExpectedRegex = NULL; private ${PHPUnit_Framework_TestCase}:outputExpectedString = NULL; private ${PHPUnit_Framework_TestCase}:hasPerformedExpectationsOnOutput = FALSE; private ${PHPUnit_Framework_TestCase}:outputCallback = FALSE; private ${PHPUnit_Framework_TestCase}:outputBufferingActive = TRUE }) C:\inetpub\symfony23\vendor\phpunit\phpunit\PHPUnit\Framework\TestCase.php:783
    0.1630    2593768  10. PHPUnit_Framework_TestCase->runBare() C:\inetpub\symfony23\vendor\phpunit\phpunit\PHPUnit\Framework\TestResult.php:648
    0.1630    2610632  11. PHPUnit_Framework_TestCase->runTest() C:\inetpub\symfony23\vendor\phpunit\phpunit\PHPUnit\Framework\TestCase.php:838
    0.1630    2611264  12. ReflectionMethod->invokeArgs(class Doctrine\Tests\Common\DataFixtures\DependentFixtureTest { protected $backupGlobals = FALSE; protected $backupGlobalsBlacklist = array (); protected $backupStaticAttributes = NULL; protected $backupStaticAttributesBlacklist = array (); protected $runTestInSeparateProcess = FALSE; protected $preserveGlobalState = TRUE; private ${PHPUnit_Framework_TestCase}:inIsolation = FALSE; private ${PHPUnit_Framework_TestCase}:data = array (); private ${PHPUnit_Framework_TestCase}:dataName = ''; private ${PHPUnit_Framework_TestCase}:useErrorHandler = NULL; private ${PHPUnit_Framework_TestCase}:useOutputBuffering = NULL; private ${PHPUnit_Framework_TestCase}:expectedException = 'Doctrine\\Common\\DataFixtures\\Exception\\CircularReferenceException'; private ${PHPUnit_Framework_TestCase}:expectedExceptionMessage = ''; private ${PHPUnit_Framework_TestCase}:expectedExceptionCode = NULL; private ${PHPUnit_Framework_TestCase}:required = array ('PHP' => NULL, 'PHPUnit' => NULL, 'functions' => array (...), 'extensions' => array (...)); private ${PHPUnit_Framework_TestCase}:name = 'test_orderFixturesByDependencies_circularReferencesMakeMethodThrowCircularReferenceException'; private ${PHPUnit_Framework_TestCase}:dependencies = array (); private ${PHPUnit_Framework_TestCase}:dependencyInput = array (); private ${PHPUnit_Framework_TestCase}:iniSettings = array (); private ${PHPUnit_Framework_TestCase}:locale = array (); private ${PHPUnit_Framework_TestCase}:mockObjects = array (); private ${PHPUnit_Framework_TestCase}:status = NULL; private ${PHPUnit_Framework_TestCase}:statusMessage = ''; private ${PHPUnit_Framework_TestCase}:numAssertions = 0; private ${PHPUnit_Framework_TestCase}:result = class PHPUnit_Framework_TestResult { protected $passed = array (...); protected $errors = array (...); protected $deprecatedFeatures = array (...); protected $failures = array (...); protected $notImplemented = array (...); protected $skipped = array (...); protected $listeners = array (...); protected $runTests = 3; protected $time = 0.0080010890960693; protected $topTestSuite = class PHPUnit_Framework_TestSuite { ... }; protected $codeCoverage = NULL; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $strictMode = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; protected $timeoutForSmallTests = 1; protected $timeoutForMediumTests = 10; protected $timeoutForLargeTests = 60 }; private ${PHPUnit_Framework_TestCase}:testResult = NULL; private ${PHPUnit_Framework_TestCase}:output = ''; private ${PHPUnit_Framework_TestCase}:outputExpectedRegex = NULL; private ${PHPUnit_Framework_TestCase}:outputExpectedString = NULL; private ${PHPUnit_Framework_TestCase}:hasPerformedExpectationsOnOutput = FALSE; private ${PHPUnit_Framework_TestCase}:outputCallback = FALSE; private ${PHPUnit_Framework_TestCase}:outputBufferingActive = TRUE }, array ()) C:\inetpub\symfony23\vendor\phpunit\phpunit\PHPUnit\Framework\TestCase.php:983
    0.1630    2611336  13. Doctrine\Tests\Common\DataFixtures\DependentFixtureTest->test_orderFixturesByDependencies_circularReferencesMakeMethodThrowCircularReferenceException() C:\inetpub\symfony23\vendor\phpunit\phpunit\PHPUnit\Framework\TestCase.php:983
    0.1630    2611480  14. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture3 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\tests\Doctrine\Tests\Common\DataFixtures\DependentFixtureTest.php:105
    0.1630    2611872  15. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture2 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1630    2612232  16. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1630    2612592  17. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture3 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1630    2612952  18. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture2 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1630    2613312  19. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1630    2613680  20. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture3 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1630    2614040  21. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture2 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1630    2614400  22. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2614768  23. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture3 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2615128  24. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture2 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2615488  25. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2615848  26. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture3 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2616216  27. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture2 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2616576  28. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2616936  29. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture3 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2617296  30. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture2 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2617656  31. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2618016  32. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture3 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2618376  33. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture2 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2618736  34. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2619096  35. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture3 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2619456  36. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture2 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2619816  37. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2620176  38. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture3 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2620536  39. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture2 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2620896  40. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2621256  41. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture3 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2621616  42. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture2 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2621976  43. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2622336  44. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture3 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2622696  45. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture2 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2623056  46. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2623416  47. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture3 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2623776  48. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture2 {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142
    0.1640    2624136  49. Doctrine\Common\DataFixtures\Loader->addFixture(class Doctrine\Tests\Common\DataFixtures\CircularReferenceFixture {  }) C:\inetpub\symfony23\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Loader.php:142

Invalid declaration of ORMExecutor::setReferenceRepository()

Since today we got a runtime notice when we try load fixtures:

Runtime Notice: Declaration of Doctrine\Common\DataFixtures\Executor\ORMExecutor::setReferenceRepository() should be compatible with that of Doctrine\Common\DataFixtures\Executor\AbstractExecutor::setReferenceRepository() in /Users/jerome/Sites/ddh.local/vendor/doctrine-fixtures/lib/Doctrine/Common/DataFixtures/Executor/ORMExecutor.php line 32

PDOException by purging a table with a self-referencing association

When I try to purge a database which contains a self-referencing entity with the ORMPurger I get a PDOException :
[PDOException]
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent
row: a foreign key constraint fails (yrch.category, CONSTRAINT category_ibfk_1
FOREIGN KEY (parent_id) REFERENCES category (id))

Self-referencing association are very usefull to store hierarchical datas and it seems weird that the DataFixtures extensions cannot be used when using such datas.

missing unset/clearReference method

I miss this kind of method when using setReference with indexed names fe: $this->setReference('my_entity_'.$i, $my_entity); $i++

Another great addition would be that set Reference accept array of refs fe: $this->setReference('my_entities', $my_entities);

cheer

escaping in insert sql command

i choosed a bad name for a column: "desc" (description) but is a keyword in sql.
On command:

php app/console doctrine:fixtures:load

i receive:

[Doctrine\DBAL DBALException] An exception occurred while executing 'INSERT INTO status (desc) VALUES (?)' with params ["foo"]:

i guess with a minimal escape we can avoid problem like that.
I faced this error with mariadb sql database.

Regards,
Matteo

The purger doesn't quote table names

I have a table called "like", so when the purger queries DELETE FROM like, "like" is taken to be the MySQL keyword.

It should be escaped, like so DELETE FROM like``.

Thanks.

support for embeddable

i see a branch 2.0 is a rewrite by @guilhermeblanco

but i see that 1.x still is in good standing and here to stay, so we should make it work with embeddables from doctrine/orm 2.5

my proposal is to work on a PR to enable this to avoid the purger to try to delete the tables that are really just embeddables

anyone can offer guidance on this @Ocramius if so i would like to start a PR mentored in the right direction

Thanks ๐Ÿ˜Š

refactor Load to easier override get_class-hash method

hi there,

before i bootstrap everyhing an PR it:
for me the indexing with get_class in the loader does not work very well. I think you have a good reason to hash wich class-FQN, but i would love overload the loader, which is a little bit complicated

can I refactor the loader to use a new method hashFixture() in hasFixture and addFixture to make the loader easier extendable?

best regards

Add dependent fixtures automatically

I'm using data-fixtures implements DependentFixtureInterface. I found It only decides the ordering of fixtures. I'm wondering why it don't auto load dependencies. Actually, I miss understand it so hard, and the exception message said "Fixture MyBundle\Fixtures\ORM\LoadUserData was declared as a dependency, but it doesn't exist" is also hard to realize this mistake.

Cannot share newly persisted objects

Hello,

When I try to share objects between fixtures as explained in the ReadMe. Doctrine complains with the following message:

A new entity was found through a relationship that was not configured to cascade persist operations: XXX.
Explicitly persist the new entity or configure cascading persist operations on the relationship

I found that I must either:

  • do a single flush at the end: only when all entities have been marked to be persisted.
  • or if I flush at the end of each load method, I need to retrieve a new instance of the entity through a call to find using the id of the newly persisted entity.

I'm experimenting with symfony2 beta 1.

can not purge table which has self-referencing

I have a table has following schema:

CREATE TABLE `cities` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) DEFAULT NULL,
  `area_no` bigint(20) DEFAULT NULL,
  `name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `full_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `is_hidden` tinyint(1) NOT NULL,
  `level` smallint(6) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_D95DB16B727ACA70` (`parent_id`),
  CONSTRAINT `FK_D95DB16B727ACA70` FOREIGN KEY (`parent_id`) REFERENCES `cities` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=393 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

when I execute "php app/console doctrine:fixtures:load" I got this error:

Careful, database will be purged. Do you want to continue Y/N ?y
  > purging database



  [Doctrine\DBAL\DBALException]                                                                                                              
  An exception occurred while executing 'DELETE FROM cities':                                                                                

  SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (``.`cities`, CONSTRAINT `FK_D95DB16B727ACA70` FOREIGN KEY (`parent_id`) REFERENCES `cities` (`id`))                                      






  [PDOException]                                                                                                                             
  SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`new`.`cities`, CONSTRAINT `FK_D95DB16B727ACA70` FOREIGN KEY (`parent_id`) REFERENCES `cities` (`id`))                                      



doctrine:fixtures:load [--fixtures[="..."]] [--append] [--em="..."] [--purge-with-truncate]

looks like when we purge table like this,we should set FOREIGN_KEY_CHECKS to 0 before execute the purge sql.

How to share more than one object between doctrine fixtures?

I read this docs at Symfony site about how to share objects between Fixtures and it's fine but in my case this is how my fixtures looks like:

public function load(ObjectManager $manager)
{
    for ($i = 1; $i <= 10; $i++) {
        $strTool = new StringTools();

        $description = $strTool->generateRandomString();
        $imei = $strTool->randomNumber(17);

        $entity = new Device();

        $entity->setImei($imei);
        $entity->setDescription($description);
        $manager->persist($entity);

    }

    $manager->flush();
}

As you may notice I'm creating more than one object, how I share all of them or at least one in order to use this object in other fixtures?

Idea: grouping fixtures

I use DataFixtures for several reasons, but they usually group into one of the following cases: a) creating data that is required for my application, when a fresh new installation is made, and b) creating dummy data to simulate my application running with a lot of data.
I think we should, somehow, group the fixtures classes. An example could be something like:

namespace MyDataFixtures;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\GroupedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;

class LoadUserData extends AbstractFixture implements GroupedFixtureInterface
{
    public function load(ObjectManager $manager)
    {
    }

    public function getGroup()
    {
        return "basic_data";
    }
}

class LoadCheckinData extends AbstractFixture implements GroupedFixtureInterface
{
    public function load(ObjectManager $manager)
    {
    }

    public function getGroup()
    {
        return "extended_data";
    }
}

... then Doctrine would just load the fixtures from the group the user has requested (when a group is not provided, Doctrine loads all the fixtures).

Load file data

It is possible to add file in fixtures data?
I have field in entity:

     /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    public $imageOne;

    /**
     * @Assert\File(
     *              maxSize="100k",
     *              mimeTypes = {"image/jpg", "image/png", "image/gif"},
     *              mimeTypesMessage = "Niedozwolony plik"
     *              )
     */
    public $image;

and upload function something like http://symfony.com/doc/master/cookbook/doctrine/file_uploads.html
I wrote:

$test = new Test();
//option 1 - error
$test->image = new \Symfony\Component\HttpFoundation\File\UploadedFile(__DIR__.'/../../../../../web/logo.png', 'logo.png');

//2 - error
$test->image = file_get_contents(__DIR__.'/../../../../../web/logo.png');

//3 - error
$test->image = __DIR__.'/../../../../../web/logo.png';

PHP Fatal error: Call to a member function move() on a non-object

So, my question is - it is posible to add file with data fixtures?

Ordering fixtures: Undefined index: %loader class% in .../DataFixtures/Loader.php on line 330

When I add order to fixtures, I got notice:

PHP Notice:  Undefined index: Acme\DemoBundle\DataFixtures\ORM\LoadDemoData in /var/www/symfony/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Loader.php on line 330
PHP Stack trace:
PHP   1. {main}() /var/www/symfony/app/console:0
PHP   2. Symfony\Component\Console\Application->run() /var/www/symfony/app/console:27
PHP   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:121
PHP   4. Symfony\Component\Console\Application->doRun() /var/www/symfony/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:96
PHP   5. Symfony\Component\Console\Application->doRunCommand() /var/www/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:191
PHP   6. Symfony\Component\Console\Command\Command->run() /var/www/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:902
PHP   7. Common\CommonBundle\Command\ClearDatabaseCommand->execute() /var/www/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:241
PHP   8. Symfony\Component\Console\Command\Command->run() /var/www/symfony/src/Common/CommonBundle/Command/ClearDatabaseCommand.php:55
PHP   9. Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand->execute() /var/www/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:241
PHP  10. Doctrine\Common\DataFixtures\Loader->getFixtures() /var/www/symfony/vendor/doctrine/doctrine-fixtures-bundle/Doctrine/Bundle/FixturesBundle/Command/LoadDataFixturesDoctrineCommand.php:94
PHP  11. Doctrine\Common\DataFixtures\Loader->orderFixturesByDependencies() /var/www/symfony/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Loader.php:164
PHP  12. Doctrine\Common\DataFixtures\Loader->getUnsequencedClasses() /var/www/symfony/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Loader.php:274
  > loading [0] Acme\DemoBundle\DataFixtures\ORM\LoadDemoData
  > loading [1] Acme\Demo2Bundle\DataFixtures\ORM\LoadDemo2Data

Class is:

class LoadDemoData extends AbstractFixture implements OrderedFixtureInterface
{
    /**
     * {@inheritDoc}
     */
    public function load(ObjectManager $manager)
    {
        $object = new Demo();
        // ....
        $manager->persist($object);
        $manager->flush();

        $this->addReference('object-1', $object);
    }

    public function getOrder()
    {
        return 0;
    }

}

Without order no notice.

Dependency on doctrine/orm

How come doctrine/orm is required only while installing the dev requirements?

Can one use the bundle without doctrine/orm installed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.