當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Collection::add方法代碼示例

本文整理匯總了PHP中Doctrine\Common\Collections\Collection::add方法的典型用法代碼示例。如果您正苦於以下問題:PHP Collection::add方法的具體用法?PHP Collection::add怎麽用?PHP Collection::add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\Common\Collections\Collection的用法示例。


在下文中一共展示了Collection::add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addPost

 /**
  * Adds a post top the User's authored Posts.
  *
  * Post Author needs to be updated manually.
  *
  * @param Post $addPost
  * @return User
  */
 public function addPost(Post $addPost)
 {
     if (!$this->getAuthoredPosts()->contains($addPost)) {
         $this->authoredPosts->add($addPost);
     }
     return $this;
 }
開發者ID:warhuhn,項目名稱:log-blog,代碼行數:15,代碼來源:User.php

示例2: addOption

 /**
  * Add a given option
  *
  * @param OptionInterface $option
  * @return $this
  */
 public function addOption(OptionInterface $option)
 {
     if (!$this->hasOption($option)) {
         $this->options->add($option);
     }
     return $this;
 }
開發者ID:lmammino,項目名稱:e-foundation,代碼行數:13,代碼來源:OptionSubjectTrait.php

示例3: addOutpost

 public function addOutpost(Outpost $outpost, $sync = true)
 {
     $this->outposts->add($outpost);
     if ($sync) {
         $outpost->setOwner($this, false);
     }
 }
開發者ID:iw-reload,項目名稱:iw,代碼行數:7,代碼來源:User.php

示例4: addSubnode

 /**
  * Add subnode
  *
  * @param \Elcodi\Component\Menu\Entity\Menu\Interfaces\NodeInterface $node Node
  *
  * @return $this self Object
  */
 public function addSubnode(\Elcodi\Component\Menu\Entity\Menu\Interfaces\NodeInterface $node)
 {
     if ($node !== $this) {
         $this->subnodes->add($node);
     }
     return $this;
 }
開發者ID:hd-deman,項目名稱:elcodi,代碼行數:14,代碼來源:SubnodesTrait.php

示例5: addThirdParty

 /**
  * @param ThirdParty $thirdParty
  *
  * @return bool
  */
 public function addThirdParty(ThirdParty $thirdParty)
 {
     if ($this->thirdPartyCredentials->contains($thirdParty)) {
         return false;
     }
     return $this->thirdPartyCredentials->add($thirdParty);
 }
開發者ID:stefanotorresi,項目名稱:thorr-oauth2,代碼行數:12,代碼來源:ThirdPartyAwareTrait.php

示例6: addCheckpoint

 /**
  * @param \AntiMattr\ShipmentTracking\Model\Tracking\CheckpointInterface
  */
 public function addCheckpoint(CheckpointInterface $checkpoint)
 {
     $this->checkpoints->add($checkpoint);
     if ($this !== $checkpoint->getTracking()) {
         $checkpoint->setTracking($this);
     }
 }
開發者ID:antimattr,項目名稱:shipment-tracking,代碼行數:10,代碼來源:TrackingTrait.php

示例7: addTagging

 /**
  * {@inheritdoc}
  */
 public function addTagging(TaggingInterface $tagging)
 {
     if (!$this->hasTagging($tagging)) {
         $tagging->setTag($this);
         $this->taggings->add($tagging);
     }
 }
開發者ID:liverbool,項目名稱:dos-tagging-bundle,代碼行數:10,代碼來源:Tag.php

示例8: addEmpresa

 /**
  * @param Empresa $empresa
  */
 public function addEmpresa($empresa)
 {
     if (!$this->empresas->contains($empresa)) {
         $empresa->setDirector($this);
         $this->empresas->add($empresa);
     }
 }
開發者ID:bixlabs,項目名稱:concepto-sises,代碼行數:10,代碼來源:Director.php

示例9: addParent

 /**
  * @param Role $parent
  */
 public function addParent(Role $parent)
 {
     if ($this->parents->contains($parent)) {
         throw new LogicException(sprintf("Parent role '%s' already assigned.", $parent->getId()));
     }
     $this->parents->add($parent);
 }
開發者ID:Achse,項目名稱:petrhejna,代碼行數:10,代碼來源:Role.php

示例10: addTag

 /**
  * {@inheritdoc}
  */
 public function addTag(TagInterface $tag)
 {
     if ($this->tags->contains($tag)) {
         return;
     }
     $this->tags->add($tag);
 }
開發者ID:MHaendel,項目名稱:FOSMessage,代碼行數:10,代碼來源:ConversationPerson.php

示例11: addArchivo

 /**
  * @param Archivo $archivo
  */
 public function addArchivo($archivo)
 {
     if (!$this->archivos->contains($archivo)) {
         $archivo->setDocumentable($this);
         $this->archivos->add($archivo);
     }
 }
開發者ID:bixlabs,項目名稱:concepto-sises,代碼行數:10,代碼來源:Documentable.php

示例12: addOption

 /**
  * @param AntiMattr\Common\Product\OptionInterface
  */
 public function addOption(OptionInterface $option)
 {
     $this->options->add($option);
     if ($this !== $option->getVariation()) {
         $option->setVariation($this);
     }
 }
開發者ID:antimattr,項目名稱:common-product,代碼行數:10,代碼來源:Variation.php

示例13: testFirstAndLast

 public function testFirstAndLast()
 {
     $this->_coll->add('one');
     $this->_coll->add('two');
     $this->assertEquals($this->_coll->first(), 'one');
     $this->assertEquals($this->_coll->last(), 'two');
 }
開發者ID:GMBN,項目名稱:ZF2---DoctrineModule---ManyToOne-,代碼行數:7,代碼來源:CollectionTest.php

示例14: addTerm

 /**
  * {@inheritdoc}
  */
 public function addTerm(TermInterface $term)
 {
     if (!$this->hasOption($term)) {
         $this->terms->add($term);
     }
     return $this;
 }
開發者ID:ivannis,項目名稱:UlaboxRulerBundle,代碼行數:10,代碼來源:CompountTerm.php

示例15: addArticleSubmissionFile

 /**
  * Add submissionFiles
  *
  * @param  ArticleSubmissionFile $articleSubmissionFile
  * @return $this
  */
 public function addArticleSubmissionFile(ArticleSubmissionFile $articleSubmissionFile)
 {
     if (!$this->articleSubmissionFiles->contains($articleSubmissionFile)) {
         $this->articleSubmissionFiles->add($articleSubmissionFile);
     }
     return $this;
 }
開發者ID:beyzakokcan,項目名稱:ojs,代碼行數:13,代碼來源:ArticleSubmissionStart.php


注:本文中的Doctrine\Common\Collections\Collection::add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。