PHP code example of delboy1978uk / person

1. Go to this page and download the library: Download delboy1978uk/person library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

delboy1978uk / person example snippets


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

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

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);

$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

$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

use Del\Person\Criteria\PersonCriteria;

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

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