Attila/lib/Entity.php
public static function getAllEntity($oEntityCall, $bReturnNotNulOnly = false)
	{
		if (!is_object($oEntityCall)) { return array(); }

		$oReflectionClass = new \ReflectionClass(get_class($oEntityCall));
		$oReflectionMethod = $oReflectionClass->getMethods();
		$aFieldsToReturn = array();

		foreach ($oReflectionMethod as $aMethod) {

			if (preg_match('/^get_[a-zA-Z_]+/', $aMethod->getName())) {

				$sMethodsCall = $aMethod->getName();
				$sFieldName = preg_replace('/^get_/', '', $aMethod->getName());

				if ($oEntityCall->$sMethodsCall() !== null || ($oEntityCall->$sMethodsCall() === null
					&& $bReturnNotNulOnly === false)) {

					$aFieldsToReturn[$sFieldName] = $oEntityCall->$sMethodsCall();
				}
			}
		}

		$oReflectionProperties = $oReflectionClass->getProperties();

		foreach ($oEntityCall as $sKey => $aProperty) {

			$aFieldsToReturn[$sKey] = self::getAllEntity($aProperty, $bReturnNotNulOnly);
		}

		return $aFieldsToReturn;
	}
public static function getAllEntity($oEntityCall, $bReturnNotNulOnly = false)
	{
		if (!is_object($oEntityCall)) { return array(); }

		$oReflectionClass = new \ReflectionClass(get_class($oEntityCall));
		$oReflectionMethod = $oReflectionClass->getMethods();
		$aFieldsToReturn = array();

		foreach ($oReflectionMethod as $aMethod) {

			if (preg_match('/^get_[a-zA-Z_]+/', $aMethod->getName())) {

				$sMethodsCall = $aMethod->getName();
				$sFieldName = preg_replace('/^get_/', '', $aMethod->getName());

				if ($oEntityCall->$sMethodsCall() !== null || ($oEntityCall->$sMethodsCall() === null
					&& $bReturnNotNulOnly === false)) {

					$aFieldsToReturn[$sFieldName] = $oEntityCall->$sMethodsCall();
				}
			}
		}

		$oReflectionProperties = $oReflectionClass->getProperties();

		foreach ($oEntityCall as $sKey => $aProperty) {

			$aFieldsToReturn[$sKey] = self::getAllEntity($aProperty, $bReturnNotNulOnly);
		}

		return $aFieldsToReturn;
	}
public static function getAllEntity ( $ oEntityCall , $ bReturnNotNulOnly = false ) { if ( ! is_object ( $ oEntityCall ) ) { return array ( ) ; } $ oReflectionClass = new \ ReflectionClass ( get_class ( $ oEntityCall ) ) ; $ oReflectionMethod = $ oReflectionClass -> getMethods ( ) ; $ aFieldsToReturn = array ( ) ; foreach ( $ oReflectionMethod as $ aMethod ) { if ( preg_match ( '/^get_[a-zA-Z_]+/' , $ aMethod -> getName ( ) ) ) { $ sMethodsCall = $ aMethod -> getName ( ) ; $ sFieldName = preg_replace ( '/^get_/' , '' , $ aMethod -> getName ( ) ) ; if ( $ oEntityCall -> $ sMethodsCall ( ) !== null || ( $ oEntityCall -> $ sMethodsCall ( ) === null && $ bReturnNotNulOnly === false ) ) { $ aFieldsToReturn [ $ sFieldName ] = $ oEntityCall -> $ sMethodsCall ( ) ; } } } $ oReflectionProperties = $ oReflectionClass -> getProperties ( ) ; foreach ( $ oEntityCall as $ sKey => $ aProperty ) { $ aFieldsToReturn [ $ sKey ] = self :: getAllEntity ( $ aProperty , $ bReturnNotNulOnly ) ; } return $ aFieldsToReturn ; }
get all field of entity in array

@access public
@param  object $oEntityCall domain that we want load
@param  bool $bReturnNotNulOnly if we return the null response
@return array
get all field of entity in array