For Items enabled a PID to be generated from ParentRef and Name

This commit is contained in:
Deon George 2023-05-09 22:44:53 +09:00
parent 179c96ca5d
commit 0076ecef31
2 changed files with 16 additions and 0 deletions

View File

@ -70,6 +70,9 @@ final class Item extends Model
case 'updated_at':
return object_get($this->getAttribute('MetaData'),'LastUpdatedTime');
case 'pid':
return (($x=object_get($this->getAttribute('ParentRef'),'name')) ? $x.':' : '').$this->Name;
default:
return parent::__get(Arr::get($keymap,$key,$key));
}

View File

@ -57,6 +57,19 @@ class ListList extends Base implements \Countable, \ArrayAccess, \Iterator
}
}
public function __call(string $name,array $args)
{
switch ($name) {
case 'first':
return $this->_data->{$name}();
case 'pluck':
return $this->_data->map(function($item) use ($args) { return $item->{$args[0]}; });
default:
throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()',get_class($this),$name));
}
}
public function current(): mixed
{
return $this->_data[$this->counter];