setReadOnlyValue() public method

Sets read-only value.
public setReadOnlyValue ( string $name, mixed $value ) : self
$name string
$value mixed
return self
Esempio n. 1
0
 protected function fill(IEntity $entity, array $params)
 {
     foreach ($entity->getMetadata()->getProperties() as $property) {
         if ($property->isReadonly) {
             continue;
         }
         $key = $property->name;
         if (array_key_exists($key, $params)) {
             $value = $params[$key];
             unset($params[$key]);
         } elseif ($property->isNullable || $property->isVirtual || $property->isPrimary || $entity->hasValue($key)) {
             continue;
         } else {
             $value = $this->random($property);
         }
         $entity->setReadOnlyValue($key, $value);
     }
 }