private static function assemblyObject(Prototyped $object, $array, $prefix = null)
 {
     if ($object instanceof DAOConnected) {
         $dao = $object->dao();
     } else {
         $dao = null;
     }
     $proto = $object->proto();
     foreach ($proto->getPropertyList() as $property) {
         $setter = $property->getSetter();
         if ($property instanceof InnerMetaProperty) {
             $object->{$setter}($property->toValue($dao, $array, $prefix));
         } elseif ($property->isBuildable($array, $prefix)) {
             if ($property->getRelationId() == MetaRelation::ONE_TO_ONE) {
                 if ($property->getFetchStrategyId() == FetchStrategy::LAZY) {
                     $columnName = $prefix . $property->getColumnName();
                     $object->{$setter . 'Id'}($array[$columnName]);
                     continue;
                 }
             }
             $object->{$setter}($property->toValue($dao, $array, $prefix));
         }
     }
     return $object;
 }
 private function spawnObject(Prototyped $object, array $options)
 {
     foreach ($object->proto()->getPropertyList() as $propName => $property) {
         /* @var $property LightMetaProperty */
         if (isset($options[$propName])) {
             $setter = $property->getSetter();
             $object->{$setter}($options[$propName]);
         }
     }
     return $object;
 }
Пример #3
0
 public static function checkPrototyped(Prototyped $object)
 {
     $form = $object->proto()->makeForm();
     self::object2form($object, $form, false);
     return $form->getErrors();
 }