goodwritehq / factory-girl-php Goto Github PK
View Code? Open in Web Editor NEWA PHP port of Ruby's Factory Girl.
A PHP port of Ruby's Factory Girl.
When assigning an array of entities to a collection field, these values are simply ignored:
if ($metadata->isCollectionValuedAssociation($fieldName)) {
$metadata->setFieldValue($ent, $fieldName, new ArrayCollection());
}
.....
To get a whole list of objects, a "get many" method would be super.
E.g.:
$items = $this->factory->getList('MyEntity', 10);
// items is an array with ten MyEntity instances
Hi there,
how do you guys feel about named and inherited factories?
Say we have an entity MyEntity
:
class MyEntity
{
public $name;
public $active = true;
}
And define the Factory:
$this->factory->defineEntity('MyEntity', [
'name' => 'paul',
'active' => true,
]);
I find myself wanting to extend given factories in more complex scenarios.
So how about some way to name different Factories of the same Entity e.g.:
$this->factory->defineEntity('MyEntity::inactive', [
'name' => 'paul',
'active' => false,
]);
// get a factory
$this->factory->get('MyEntity::inactive')
And to not have to repeat the 'name' => 'paul'
it would be convenient to be able to have some form of inheritance.
Is anything like this in the works?
For some reason I cannot figure out yet why the class metadata fetched by the \Doctrine\ORM\EntityManager::getClassMetadata()
does not contain any of the properties defined in the superclass.
For example I'm unable to generate a \FOS\UserBundle\Model
descendants factory due to required emailCanonical
field being defined in the superclass, not in my implementation (which I'm building the factory against).
A conservative 0.1.0 maybe?
@unhashable is there any chance you could login on packagist.org to reenable auto-update for this package?
In order to make it easier to use the library on any composer based project, could you please register the library on packagist.org?
Hi folks,
I'm trying to get SpaceShip
factory build more than one Person
. I only found Person -> SpaceShip
test but no one SpaceShip -> ArrayCollection([Person, Person])
.
There is any way to get FieldDef::sequence()
build relations to a one2many relation?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.