This would improve support for polymorphic model relationships, similar to CollectionContainerTrait.
This would probably require a dedicated model loader that also resolves. Alternatively, just use a collection loader.
|
/** |
|
* Set the object type. |
|
* |
|
* @param string $objType The object type. |
|
* @throws InvalidArgumentException If provided argument is not of type 'string'. |
|
* @return ObjectContainerInterface Chainable |
|
*/ |
|
public function setObjType($objType) |
|
{ |
|
if (!is_string($objType)) { |
|
throw new InvalidArgumentException(sprintf( |
|
'Object type must be a string, received %s.', |
|
(is_object($objType) ? get_class($objType) : gettype($objType)) |
|
)); |
|
} |
|
|
|
$this->objType = str_replace(['.', '_'], '/', $objType); |
|
|
|
return $this; |
|
} |
|
|
|
/** |
|
* Retrieve the object type. |
|
* |
|
* @return string|null |
|
*/ |
|
public function objType() |
|
{ |
|
return $this->objType; |
|
} |
This would improve support for polymorphic model relationships, similar to
CollectionContainerTrait.This would probably require a dedicated model loader that also resolves. Alternatively, just use a collection loader.
charcoal/packages/admin/src/Charcoal/Admin/Ui/ObjectContainerTrait.php
Lines 88 to 117 in c72eca8