9trait FieldAccessImplementation
13 return isset(static::mirrorDataEntityFields()[$offset]);
18 if ($field = static::mirrorDataEntityFields()[$offset])
20 if (isset($field[
'alias']))
22 $field = static::mirrorDataEntityFields()[$field[
'alias']];
25 ($getter = $field[
'get'])
27 && is_callable([$this, $getter])
30 return $this->$getter();
33 return $this->{$field[
'field']};
39 public function offsetSet($offset, $value): void
41 if ($field = static::mirrorDataEntityFields()[$offset])
43 if (isset($field[
'alias']))
45 $field = static::mirrorDataEntityFields()[$field[
'alias']];
47 if (!isset($field[
'primary']))
50 ($setter = $field[
'set'])
52 && is_callable([$this, $setter])
55 $this->$setter($value);
59 $this->{$field[
'field']} = $value;
67 if ($field = static::mirrorDataEntityFields()[$offset])
69 if (isset($field[
'alias']))
71 $field = static::mirrorDataEntityFields()[$field[
'alias']];
73 if (!isset($field[
'primary']))
75 $this->{$field[
'field']} =
null;
offsetSet($offset, $value)