Ejemplo n.º 1
0
 protected function setAndFilterProperties(array &$attributes)
 {
     $accProps = AccessibleProperties::getProperties(get_called_class());
     $this->filterProperties($attributes, $accProps);
 }
Ejemplo n.º 2
0
 protected function getPropertyGetter($modelClass, $propName)
 {
     if (Attributes::isClassAttribute($modelClass, $propName)) {
         return function ($model) use($propName) {
             return $model->getAttribute($propName);
         };
     } else {
         $property = AccessibleProperties::getProperty($modelClass, $propName);
         if ($property === true) {
             return function ($model) use($propName) {
                 $model->{$propName};
             };
         } elseif ($property[0]) {
             return function ($model) use($propName) {
                 $model->{$propName}();
             };
         }
     }
     throw new Exception\RuntimeException(sprintf("Unknown attribute or property %s::%s", $modelClass, $propName));
 }