Some useful tools to improve Doctrine ORM experience.
New class: BaseEntityRepository
$indexBy: The methods
findAllaccept a last argument allowing to index the returned array with the value from one of the entity properties (by default, primary key, if set to
findAllRoot: Retrieves only “root” objects, without any join of associated entities. Note: Cancels the effects of
fetch="EAGER"on the entity.
findAllRootbut returns the result as PHP array.
sortCollection: Use to index an array of entities based on one of its properties, mostly a unique index. Default is set to the primary key.
getIds: Returns all “id” values from the database in an array.
New class: AbstractFixture
To be used with
You can now add your fixtures directly in a PHP array, like from a PhpMyAdmin export for example. It is also possible to specify the fixtures priority, and a potential prefix to be used to create references of each fixture reusable in other fixtures classe. The prefix will be appended by the “id” if specified, or the string representation of the entity if not. Bonus: If you specify an “id”, it will be inserted as-is.