2017 © Pedro Peláez
 

symfony-bundle entity-factory-bundle

Entity factory bundle for Symfony 4

image

lkovace18/entity-factory-bundle

Entity factory bundle for Symfony 4

  • Sunday, May 6, 2018
  • by lkovace18
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,128 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 37 % Grown

The README.md

Symfony Entity factory

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., (*1)

$productData = $factory->values(User::class);

The Versions