public function __construct($data = null) { if ($data) { parent::__construct($data); } }
/** * Вычитание коллекций из текущей коллекции * Поведение аналогично array_diff() * * @param AbstractCollection $collection * @return AbstractCollection */ public function diff(AbstractCollection $collection) { $className = get_class($this); $collectionNew = new $className(); foreach ($this as $entity) { if (!$collection->containsEntity($entity)) { $collectionNew[] = $entity; } } return $collectionNew; }