- Fixed an alias problem within deleteFromPk() method
This commit is contained in:
1 parent
953fc35680
commit
667c1fe9ab
2 files changed
+8
-5
No files matched your search
+3
-3
@@ -114,7 +114,7 @@ class Repository
|
||||
throw new Exception\EntityPrimaryKeyUnknown("A primary key value has to be defined to delete an item.");
|
||||
}
|
||||
|
||||
return (bool) $this->wherePrimaryKey($value)->deleteOne()->rowCount;
|
||||
return (bool) $this->wherePrimaryKey($value, null)->deleteOne()->rowCount;
|
||||
}
|
||||
|
||||
public function destroy(object $entity) : bool
|
||||
@@ -599,7 +599,7 @@ class Repository
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function wherePrimaryKey(mixed $value) : self
|
||||
public function wherePrimaryKey(mixed $value, null|string|bool $alias = self::DEFAULT_ALIAS) : self
|
||||
{
|
||||
if ( null === $primaryKeyField = Ulmus::resolveEntity($this->entityClass)->getPrimaryKeyField() ) {
|
||||
throw new Exception\EntityPrimaryKeyUnknown("Entity has no field containing attributes 'primary_key'");
|
||||
@@ -607,7 +607,7 @@ class Repository
|
||||
|
||||
$pkField = key($primaryKeyField);
|
||||
|
||||
return $this->where($this->entityClass::field($primaryKeyField[$pkField]->name ?? $pkField), $value);
|
||||
return $this->where($this->entityClass::field($primaryKeyField[$pkField]->name ?? $pkField, false), $value);
|
||||
}
|
||||
|
||||
public function withJoin(string|array $fields, array $options = []) : self
|
||||
|
||||
Reference in new issue
Block a user