protected function entityToArray($class, $object)
    {
        if (is_object($object) && get_class($object) == $class) {
            $object = $object->toArray();
        }
        return $object;
    }
protected function entityToArray($class, $object)
    {
        if (is_object($object) && get_class($object) == $class) {
            $object = $object->toArray();
        }
        return $object;
    }
protected function entityToArray ( $ class , $ object ) { if ( is_object ( $ object ) && get_class ( $ object ) == $ class ) { $ object = $ object -> toArray ( ) ; } return $ object ; }
Return entity transformed to array

@param string $class  Entity class
@param mixed  $object Entity object or array

@return array
Return entity transformed to array