lkovace18 / entity-factory-bundle
Entity factory bundle for Symfony 4
Installs: 3 775
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 2
Open Issues: 0
Type:symfony-bundle
Requires
- php: >= 7.1
- dflydev/dot-access-data: ^1.0
- doctrine/doctrine-bundle: ^1.6
- doctrine/orm: ^2.5
- fzaninotto/faker: ^1.5
- symfony/console: >=3.2.13 || ^4.0
- symfony/dependency-injection: >=3.2.13 || ^4.0
- symfony/expression-language: >=3.2.13 || ^4.0
- symfony/property-access: >=3.2.13 || ^4.0
- symfony/yaml: >=3.2.13 || ^4.0
Requires (Dev)
- matthiasnoback/symfony-dependency-injection-test: ^0.7.6
- mikey179/vfsstream: ^1.6.1
- phpunit/phpunit: ^5.6
- symfony/finder: ^3.2 || ^4.0
- symfony/framework-bundle: >=3.2.13 || ^4.0
- symfony/http-kernel: >=3.2.13 || ^4.0
This package is auto-updated.
Last update: 2024-10-29 03:53:31 UTC
README
Usage
How to use
Create Entity
$factory->create(User::class);
Create multiple entities
$factory->times(10)->create(Beer::class); /* This will generate 10 persisted beers with fake values */
Create Entity and override some data
$user = $factory->create( User::class, [ 'username' => 'BadassAdmin' 'active' => true ] );
Create new instance
$post = $factory->make(User::class)
Get fake values for an entity
Maybe you don't want an instance of the entity, but need some fake data to create you entity object. The values
method will return an array of fake values for an entity.
$productData = $factory->values(User::class);