2017 © Pedro Peláez
 

library person

A persistable person entity, repository, and service.

image

delboy1978uk/person

A persistable person entity, repository, and service.

  • Friday, June 22, 2018
  • by delboy1978uk
  • Repository
  • 1 Watchers
  • 0 Stars
  • 485 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 22 Versions
  • 22 % Grown

The README.md

person

Build Status Code Coverage Scrutinizer Code Quality
A persistable Person Entity, Collection, Repository, and Service, written in PHP., (*1)

Installation

Install via composer into your project:, (*2)

composer require delboy1978uk/person

Setup and Usage

You can use delboy1978uk/common, which contains Doctrine2 ORM for database persistance, and Pimple as a dependency injection container. You can register the Person DIC items using the Del\Person\PersonPackage object. See delboy1978uk/common for details., (*3)

use Del\Commohn\ContainerService;
use Del\Person\PersonPackage;

$package = new PersonPackage();
ContainerService::getInstance()->registerToContainer($config);

The Person Entity

The $date variable is a DateTime object. $country is a a Del\Entity\Country object., (*4)

use Del\Person\Entity\Person;

$del = new Person();
$del->setFirstname('Derek')
    ->setMiddlename('Stephen')
    ->setLastname('McLean)
    ->setAka('Del Boy')
    ->setDob($date)
    ->setBirthplace('Glasgow, Scotland')
    ->setCountry($country);

The Person Collection

Or people, as we might like to call it., (*5)

Del\Person\Collection\PersonCollection extends ArrayIterator and contains the following (additional) methods:, (*6)

$collection->update($person); // Updates the entity in the collection with fresh details
$collection->append($person); // Adds an entity to the collection
$collection->current(); // Retrieves the currently selected Person object
$collection->findKey($person); // Retrieves the array offset key for any Person in the collection
$collection->findById($id); // Retrieves a Person from the collection by their Id

The Person Service

Del\Person\Service\PersonService contains a few methods for dealing with Person objects., (*7)

$svc->createFromArray($data); // Person object factory method accepting an array
$svc->toArray($person); // Pass a Person, receive an array
$svc->savePerson($person); // Saves a Person (adds or updates) to the database
$svc->getRepository(); // Gets the Person Repository
$svc->findByCriteria($criteria); // Finds results based upon your Criteria (see below)
$svc->findOneByCriteria($criteria); // As above but for a single result

The Person Criteria

Set the criteria for your searches using this object., (*8)

use Del\Person\Criteria\PersonCriteria;

$criteria = new PersonCriteria();
$criteria->setFirstname('Derek');
$criteria->setLastname('McLean');

$results = $svc->findByCriteria($criteria); // array of Person objects

The Versions

22/06 2018

dev-master

9999999-dev

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

22/06 2018

dev-dev-master

dev-dev-master

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

22/06 2018

v5.0.0

5.0.0.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

07/01 2018

v4.0.5

4.0.5.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

07/01 2018

v4.0.4

4.0.4.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

07/01 2018

v4.0.3

4.0.3.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

07/01 2018

v4.0.2

4.0.2.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

05/10 2016

v4.0.1

4.0.1.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

21/03 2016

v4.0.0

4.0.0.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

08/03 2016

v3.0.6

3.0.6.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

31/01 2016

v3.1.0

3.1.0.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

15/01 2016

v3.0.5

3.0.5.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

12/01 2016

v3.0.4

3.0.4.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

12/01 2016

v3.0.3

3.0.3.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

12/01 2016

v3.0.2

3.0.2.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

12/01 2016

v3.0.1

3.0.1.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

07/01 2016

v3.0.0

3.0.0.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

06/01 2016

v2.0.3

2.0.3.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

22/12 2015

v2.0.2

2.0.2.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

22/12 2015

v2.0.1

2.0.1.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

15/11 2015

v2.0.0

2.0.0.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires

31/10 2015

v1.0.0

1.0.0.0

A persistable person entity, repository, and service.

  Sources   Download

MIT

The Requires

 

The Development Requires