Ejemplo n.º 1
0
 public function __construct($data = null)
 {
     if ($data) {
         parent::__construct($data);
     }
 }
Ejemplo n.º 2
0
 /**
  * Вычитание коллекций из текущей коллекции
  * Поведение аналогично 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;
 }