Skip to content

geosocio/entity-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Entity Utilities Build Status Coverage Status

Provides simply Doctrine Entity Utilities.

Parameter Bag

Easily construct an entity through the constructor.

use GeoSocio\EntityUtils\ParameterBag;

class User {

  __construct(array $data = []) {
    $params = new ParameterBag($data);
    $this->id = $params->getInt('id');
    $this->first = $params->getString('first');
    $this->last = $params->getString('last');
    $this->address = $params->getInstance('address', Address::class, new Address());
    $this->posts = $params->getCollection('posts', Post::class, new ArrayCollection());
  }

}

CreatedTrait

Include the trait in your entity to add a 'created' field that is added on persist.

use GeoSocio\EntityUtils\CreatedTrait;

class User {

  use CreatedTrait;

}

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages