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

Normally this is as simple as $entity->$key = $value although more complicated transforms can happen should a field type choose to override this method. Note too that this will also be the default method called for an entity builder which is designed to receive raw data to initialise an entity.
public set ( object $entity, mixed $value )
$entity object
$value mixed
Пример #1
0
 /**
  * The set method gets called directly by a new entity builder. For this field we never want to allow
  * null values, rather we want an empty collection so this overrides the default and handles that.
  *
  * @param object $entity
  * @param mixed  $val
  */
 public function set($entity, $val)
 {
     if ($val === null) {
         $val = new RepeatingFieldCollection($this->em, $this->mapping);
     }
     return parent::set($entity, $val);
 }