- Added a new EntityCollection factory

This commit is contained in:
Dave Mc Nicoll 2020-06-29 11:36:41 -04:00
parent 8e521025d3
commit 538af38769
2 changed files with 10 additions and 2 deletions

View File

@ -332,7 +332,7 @@ trait EntityTrait {
public function isLoaded() : bool
{
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);
@ -372,6 +372,14 @@ trait EntityTrait {
return Ulmus::repository(static::class, $alias);
}
/**
* @Ignore
*/
public static function entityCollection(...$arguments) : EntityCollection
{
return new EntityCollection(...$arguments);
}
/**
* @Ignore
*/

View File

@ -638,7 +638,7 @@ class Repository
public function instanciateEntityCollection() : EntityCollection
{
return new EntityCollection();
return $this->entityClass::entityCollection();
}
public function escapeTable(string $identifier) : string