Entity теперь имплементирует Arrayable и ArrayAccess для совместимости с иммутабельными методами коллекций

This commit is contained in:
2021-12-08 15:55:52 +08:00
parent b57acf8b05
commit 793549aaac
3 changed files with 56 additions and 5 deletions

View File

@@ -87,6 +87,7 @@ abstract class EntityCollection extends Collection
*/
public function checkCount(array $items = []): void
{
//TODO проверять пустоту?
if (count($items) > static::MAX_COUNT || $this->count() === static::MAX_COUNT) {
throw new (static::EXCEPTION_CLASS)(static::MAX_COUNT);
}