library/SDIS62/Model/Abstract.php
protected function extractRecursive(array &$array)
    {
        foreach($array as $key => &$var)
        {
            if(substr($key, 0, 8) == 'related_')
            {
                unset($array[$key]);
                continue;
            }
            elseif(is_object($var))
            {
                if($var instanceof Doctrine\ORM\PersistentCollection)
                {
                    $var = $var->toArray();
                    
                }
                elseif($var instanceof Doctrine\Common\Collections\ArrayCollection)
                {
                    $var = $var->toArray();
                }
                elseif($var instanceof \DateTime)
                {
                    $var = $var->format('H:i:s') == "00:00:00" ? $var->format('Y-m-d') : $var->format('Y-m-d H:i:s');
                }
                else
                {
                    $var = $var->extract();
                }
            }
            
            if(is_array($var))
            {   
                $this->extractRecursive($var);
            }
        }
    }
protected function extractRecursive(array &$array)
    {
        foreach($array as $key => &$var)
        {
            if(substr($key, 0, 8) == 'related_')
            {
                unset($array[$key]);
                continue;
            }
            elseif(is_object($var))
            {
                if($var instanceof Doctrine\ORM\PersistentCollection)
                {
                    $var = $var->toArray();
                    
                }
                elseif($var instanceof Doctrine\Common\Collections\ArrayCollection)
                {
                    $var = $var->toArray();
                }
                elseif($var instanceof \DateTime)
                {
                    $var = $var->format('H:i:s') == "00:00:00" ? $var->format('Y-m-d') : $var->format('Y-m-d H:i:s');
                }
                else
                {
                    $var = $var->extract();
                }
            }
            
            if(is_array($var))
            {   
                $this->extractRecursive($var);
            }
        }
    }
protected function extractRecursive ( array & $ array ) { foreach ( $ array as $ key => & $ var ) { if ( substr ( $ key , 0 , 8 ) == 'related_' ) { unset ( $ array [ $ key ] ) ; continue ; } elseif ( is_object ( $ var ) ) { if ( $ var instanceof Doctrine \ ORM \ PersistentCollection ) { $ var = $ var -> toArray ( ) ; } elseif ( $ var instanceof Doctrine \ Common \ Collections \ ArrayCollection ) { $ var = $ var -> toArray ( ) ; } elseif ( $ var instanceof \ DateTime ) { $ var = $ var -> format ( 'H:i:s' ) == "00:00:00" ? $ var -> format ( 'Y-m-d' ) : $ var -> format ( 'Y-m-d H:i:s' ) ; } else { $ var = $ var -> extract ( ) ; } } if ( is_array ( $ var ) ) { $ this -> extractRecursive ( $ var ) ; } } }
Fonction permettant l'extraction d'un objet de façon récursive
Ignore les attributs commençants par "related_"

@param array $array Paramètre passé par référence
Fonction permettant l extraction d un objet de façon récursive Ignore les attributs commençants par related_