Nextras\Orm\Entity\IEntity::getRawProperty PHP Метод

getRawProperty() публичный Метод

Returns property raw contents.
public getRawProperty ( string $name ) : mixed
$name string
Результат mixed
    public function getRawProperty($name);

Usage Example

Пример #1
0
 /**
  * Returns entity relationships as array, 0 => pre, 1 => post, 2 => nulls
  * @param  IEntity  $entity
  * @return array
  */
 public static function getRelationships(IEntity $entity)
 {
     $return = [[], [], []];
     foreach ($entity->getMetadata()->getProperties() as $propertyMeta) {
         if ($propertyMeta->relationship === NULL) {
             continue;
         }
         $name = $propertyMeta->name;
         if (!$propertyMeta->relationship->cascade['remove']) {
             $return[2][$name] = $propertyMeta;
             continue;
         }
         $rawValue = $entity->getRawProperty($name);
         if (!is_object($rawValue) && $propertyMeta->isNullable) {
             continue;
         }
         $property = $entity->getProperty($name);
         if ($property instanceof IRelationshipContainer) {
             $value = $entity->getValue($name);
             if ($value) {
                 if ($propertyMeta->relationship->type === Relationship::ONE_HAS_ONE && !$propertyMeta->relationship->isMain) {
                     $return[0][$name] = $value;
                 } else {
                     $return[1][$name] = $value;
                 }
             }
         } elseif ($property instanceof IRelationshipCollection) {
             $return[0][$name] = $entity->getValue($name);
         }
     }
     return $return;
 }
All Usage Examples Of Nextras\Orm\Entity\IEntity::getRawProperty