Download the PHP package nemesis/doctrine-array-hydrator without Composer
On this page you can find all versions of the php package nemesis/doctrine-array-hydrator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package doctrine-array-hydrator
Doctrine Array to Entity Hydrator
Introduction
A hydrator for doctrine 2 that converts an array to the entity of your choice.
Installing via Composer
The recommended way to install is through Composer.
composer require pmill/doctrine-array-hydrator
Example
Given this doctrine entity:
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="users")
*/
class User
{
/**
* @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue
* @var int
*/
protected $id;
/**
* @ORM\Column(type="string")
* @var string
*/
protected $name;
/**
* @ORM\Column(type="string")
* @var string
*/
protected $email;
/**
* @ManyToOne(targetEntity="Company")
* @var Company
*/
protected $company;
/**
* @OneToMany(targetEntity="Permission", mappedBy="product")
* @var Permission[]
*/
protected $permissions;
...
We can populate this object with an array, for example:
$data = [
'name'=>'Fred Jones',
'email'=>'[email protected]',
'company'=>2,
'permissions'=>[1, 2, 3, 4];
];
$hydrator = new \pmill\Doctrine\Hydrator\ArrayHydrator($entityManager);
$entity = $hydrator->hydrate('App\Entity\User', $data);
Copyright
Doctrine Array to Entity Hydrator Copyright (c) 2015 pmill ([email protected]) All rights reserved.
All versions of doctrine-array-hydrator with dependencies
PHP Build Version
Package Version
Requires
doctrine/orm Version
^2.5
The package nemesis/doctrine-array-hydrator contains the following files
Loading the files please wait ....