当前位置: 首页>>代码示例>>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;未经允许,请勿转载。