- Added a new EntityCollection factory
This commit is contained in:
parent
8e521025d3
commit
538af38769
|
@ -332,7 +332,7 @@ trait EntityTrait {
|
||||||
public function isLoaded() : bool
|
public function isLoaded() : bool
|
||||||
{
|
{
|
||||||
if ( null === $pkField = $this->resolveEntity()->getPrimaryKeyField($this) ) {
|
if ( null === $pkField = $this->resolveEntity()->getPrimaryKeyField($this) ) {
|
||||||
throw new Exception\EntityPrimaryKeyUnknown("Entity has no field containing attributes 'primary_key'");
|
throw new Exception\EntityPrimaryKeyUnknown(sprintf("Entity %s has no field containing attributes 'primary_key'", static::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = key($pkField);
|
$key = key($pkField);
|
||||||
|
@ -372,6 +372,14 @@ trait EntityTrait {
|
||||||
return Ulmus::repository(static::class, $alias);
|
return Ulmus::repository(static::class, $alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Ignore
|
||||||
|
*/
|
||||||
|
public static function entityCollection(...$arguments) : EntityCollection
|
||||||
|
{
|
||||||
|
return new EntityCollection(...$arguments);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Ignore
|
* @Ignore
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -638,7 +638,7 @@ class Repository
|
||||||
|
|
||||||
public function instanciateEntityCollection() : EntityCollection
|
public function instanciateEntityCollection() : EntityCollection
|
||||||
{
|
{
|
||||||
return new EntityCollection();
|
return $this->entityClass::entityCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function escapeTable(string $identifier) : string
|
public function escapeTable(string $identifier) : string
|
||||||
|
|
Loading…
Reference in New Issue