示例#1
0
 /**
  * {@inheritdoc}
  */
 public function add($value)
 {
     /* Initialize the collection before calling add() so this append operation
      * uses the appropriate key. Otherwise, we risk overwriting original data
      * when $newObjects are re-added in a later call to initialize().
      */
     if (isset($this->mapping['strategy']) && CollectionHelper::isHash($this->mapping['strategy'])) {
         $this->initialize();
     }
     $this->coll->add($value);
     $this->changed();
     if ($this->uow !== null && $this->isOrphanRemovalEnabled() && $value !== null) {
         $this->uow->unscheduleOrphanRemoval($value);
     }
     return true;
 }