2017 © Pedro Peláez
 

library doctrine-array-hydrator

An array to entity hydrator for Doctrine 2 entities

image

nemesis/doctrine-array-hydrator

An array to entity hydrator for Doctrine 2 entities

  • Tuesday, August 8, 2017
  • by nemesis1988
  • Repository
  • 1 Watchers
  • 1 Stars
  • 734 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Doctrine Array to Entity Hydrator

Introduction

Build Status Code Climate Test Coverage Test Coverage, (*1)

A hydrator for doctrine 2 that converts an array to the entity of your choice., (*2)

Installing via Composer

The recommended way to install is through Composer., (*3)

composer require pmill/doctrine-array-hydrator

Example

Given this doctrine entity:, (*4)

<?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:, (*5)

$data = [
    'name'=>'Fred Jones',
    'email'=>'fred@example.com',
    'company'=>2,
    'permissions'=>[1, 2, 3, 4];
];

$hydrator = new \pmill\Doctrine\Hydrator\ArrayHydrator($entityManager);
$entity = $hydrator->hydrate('App\Entity\User', $data);

Doctrine Array to Entity Hydrator Copyright (c) 2015 pmill (dev.pmill@gmail.com) All rights reserved., (*6)

The Versions

08/08 2017

dev-master

9999999-dev https://github.com/nemesis/doctrine-array-hydrator

An array to entity hydrator for Doctrine 2 entities

  Sources   Download

MIT

The Requires

 

The Development Requires

php array doctrine hydrator

08/08 2017

1.0.1

1.0.1.0 https://github.com/nemesis/doctrine-array-hydrator

An array to entity hydrator for Doctrine 2 entities

  Sources   Download

MIT

The Requires

 

The Development Requires

php array doctrine hydrator

08/08 2017

1.0.0

1.0.0.0 https://github.com/pmill/doctrine-array-hydrator

An array to entity hydrator for Doctrine 2 entities

  Sources   Download

MIT

The Requires

 

The Development Requires

php array doctrine hydrator

13/01 2017

dev-patch-1

dev-patch-1 https://github.com/pmill/doctrine-array-hydrator

An array to entity hydrator for Doctrine 2 entities

  Sources   Download

MIT

The Requires

 

The Development Requires

php array doctrine hydrator

17/02 2016

v0.1.2

0.1.2.0 https://github.com/pmill/doctrine-array-hydrator

An array to entity hydrator for Doctrine 2 entities

  Sources   Download

MIT

The Requires

 

The Development Requires

php array doctrine hydrator

28/11 2015

0.1.1

0.1.1.0 https://github.com/pmill/doctrine-array-hydrator

An array to entity hydrator for Doctrine 2 entities

  Sources   Download

MIT

The Requires

 

The Development Requires

php array doctrine hydrator

18/11 2015

v0.1.0

0.1.0.0 https://github.com/pmill/doctrine-array-hydrator

An array to entity hydrator for Doctrine 2 entities

  Sources   Download

MIT

The Requires

 

The Development Requires

php array doctrine hydrator