public function addArticle(Article $article) { if (!$this->articles->contains($article)) { $article->setFeed($this); $this->articles->add($article); } }
/** * {@inheritdoc} * * @throws UnexpectedValueException */ public function add($value) { if (!$this->acceptsType($value)) { throw $this->doUnexpectedValueError($value); } return parent::add($value); }
public function addRole($role) { !$role instanceof Role && ($role = new Role($role)); $role->addUser($this, false); $this->roles->add($role); return $this; }
/** * @param Segment $segment * * @return void */ public function add($segment) { if (!$this->exists(function ($key, Segment $element) use($segment) { return $segment->getId() == $element->getId(); })) { parent::add($segment); } }
/** * @param ContactList $contactList * * @return void */ public function add($contactList) { if (!$this->exists(function ($key, ContactList $element) use($contactList) { return $contactList->getId() == $element->getId(); })) { parent::add($contactList); } }
public function test_construct_get_add_set() { $arc = new ArrayCollection(array('aap', 'aap', 'noot')); $this->assertEquals($arc->get(0), 'aap'); $this->assertEquals($arc->get(1), 'aap'); $this->assertEquals($arc->get(2), 'noot'); $this->assertNull($arc->get(3)); $arc->add('mies'); $this->assertEquals($arc->get(0), 'aap'); $this->assertEquals($arc->get(1), 'aap'); $this->assertEquals($arc->get(2), 'noot'); $this->assertEquals($arc->get(3), 'mies'); $arc->set(1, 'mies'); $this->assertEquals($arc->get(0), 'aap'); $this->assertEquals($arc->get(1), 'mies'); $this->assertEquals($arc->get(2), 'noot'); $this->assertEquals($arc->get(3), 'mies'); }
private static function WrapContenidoList($contenidos) { //Collection<PeliculaLogica> contenidoslogica = new ArrayList<PeliculaLogica>(); $contenidoslogica = new ArrayCollection(); // Iterator<Contenido> it = $contenidos.iterator(); $it = $contenidos->getIterator(); while ($it . hasNext()) { //PeliculaLogica pl = new PeliculaLogica(it.next()); $peliculaLogica = new PeliculaLogica($it->next()); $contenidoslogica->add($peliculaLogica); } return $contenidoslogica; }
/** * @deprecicate * * @param $attributeValue * @param $attributeName * @param $object * @param $resource * @param $attributeMetatdata * @param $type */ public function normalizeDataArrayCollection($attributeValue, $attributeName, $object, $resource, $attributeMetatdata, $type) { if (is_array($attributeValue)) { $values = new ArrayCollection(); foreach ($attributeValue as $obj) { $values->add($this->denormalizeRelation($resource, $attributeMetatdata, $type->getClass(), $obj)); } $this->setValue($object, $attributeName, $values); throw new \InvalidArgumentException('Invalid json message received'); } }
/** {@inheritDoc} */ public function add($element) { $this->initialize(); $this->isDirty = true; return $this->collection->add($element); }
public function addUserValue(\Sopinet\UserPreferencesBundle\Entity\UserValue $userValue) { $this->uservalues->add($userValue); return $this; }
public function addNotification(\Sopinet\Bundle\UserNotificationsBundle\Entity\Notification $notification) { $this->notifications->add($notification); return $this; }
public function add($element) { $this->initialize(); $this->changed = true; return $this->col->add($element); }
/** * * @param Attribute $attributes * @return \Hypersites\StockBundle\Entity\Product */ public function addAttributes(Attribute $attributes) { $this->attributes->add($attributes); return $this; }
/** * {@inheritDoc} */ public function getGenes() { $genes = new ArrayCollection(); foreach ($this->getmRNAs() as $mRNA) { foreach ($mRNA->getGenes() as $gene) { if (!$genes->contains($gene) && (!$mRNA->isPolycistronic() || $this->getOrigin() == $gene)) { $genes->add($gene); } } } }
/** * Add unitPrices * * @param ProductPriceInterface $unitPrices * @return self */ public function addUnitPrice(ProductPriceInterface $unitPrices) { return $this->unitPrices->add($unitPrices); }
/** * Add state * * @param IssueState $state */ public function addState(IssueState $state) { if (!$this->states->contains($state)) { $this->states->add($state); } }
public function followUser(User $user) { $this->following->add($user); $user->followers->add($this); }