A Doctrine2 Entity Serializer

Based on:

link is licensed under http://sam.zoy.org/wtfpl/COPYING. This is turn was based on the Gist:
link https://gist.github.com/1034079#file_serializable_entity.php
category OSS
package OSS_Doctrine2
copyright Copyright (c) 2007 - 2013, Open Source Solutions Limited, Dublin, Ireland
license New BSD License

 Methods

__construct()

__construct($em) 

Parameters

$em

getEntityManager()

getEntityManager() : \Doctrine\ORM\EntityManager

Returns

\Doctrine\ORM\EntityManager

Get the maximum recursion depth

getMaxRecursionDepth() : int

Returns

int

setEntityManager()

setEntityManager(\Doctrine\ORM\EntityManager $em) 

Parameters

$em

Set the maximum recursion depth

setMaxRecursionDepth(int $maxRecursionDepth) : void

Parameters

$maxRecursionDepth

int

Serialize an entity to an array

toArray(\The $entity) : array

Parameters

$entity

\The

entity $entity

Returns

array

Convert an entity to a JSON object

toJson(\The $entity) : string

Parameters

$entity

\The

entity $entity

Returns

string

Convert an entity to XML representation

toXml(\The $entity) 

Parameters

$entity

\The

entity $entity

Exceptions

\OSS_Doctrine2_Exception

_serializeEntity()

_serializeEntity($entity) 

Parameters

$entity

 Properties

 

$_em

$_em : \Doctrine\ORM\EntityManager
 

$_maxRecursionDepth

$_maxRecursionDepth : int
 

$_recursionDepth

$_recursionDepth : int