当前位置: 首页>>代码示例>>PHP>>正文


PHP Collection::contains方法代码示例

本文整理汇总了PHP中Collection::contains方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::contains方法的具体用法?PHP Collection::contains怎么用?PHP Collection::contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Collection的用法示例。


在下文中一共展示了Collection::contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addBeneficiary

 public function addBeneficiary(BeneficiaryUser $beneficiary)
 {
     if (!$this->beneficiaries->contains($beneficiary)) {
         $this->beneficiaries->add($beneficiary);
     }
     return $this;
 }
开发者ID:trialog,项目名称:p4s-api-bundle,代码行数:7,代码来源:OrganizationUser.php

示例2: addRole

 public function addRole(Role $role)
 {
     if (!$this->roles->contains($role)) {
         $this->roles->add($role);
     }
     return $this;
 }
开发者ID:trialog,项目名称:p4s-api-bundle,代码行数:7,代码来源:SessionUser.php

示例3: addOrganization

 public function addOrganization(OrganizationUser $organization)
 {
     $organization->addBeneficiary($this);
     if (!$this->organizations->contains($organization)) {
         $this->organizations->add($organization);
     }
     return $this;
 }
开发者ID:trialog,项目名称:p4s-api-bundle,代码行数:8,代码来源:BeneficiaryUser.php

示例4: addSubscriber

 /**
  * @param SubscriberInterface $subscriber
  * @return Newsletter
  */
 public function addSubscriber(SubscriberInterface $subscriber)
 {
     if ($this->subscribers->contains($subscriber)) {
         return $this;
     }
     $subscriber->addNewsletter($this);
     $this->subscribers->add($subscriber);
     return $this;
 }
开发者ID:josephzhao,项目名称:map2ucore,代码行数:13,代码来源:Newsletter.php

示例5: hasActivity

 /**
  * {@inheritdoc}
  */
 public function hasActivity(ActivityInterface $activity)
 {
     return $this->activities->contains($activity);
 }
开发者ID:upenn-dag,项目名称:patient-repository,代码行数:7,代码来源:Regimen.php

示例6: hasChild

 /**
  * {@inheritdoc}
  */
 public function hasChild(PermissionInterface $permission)
 {
     return $this->children->contains($permission);
 }
开发者ID:aleherse,项目名称:Sylius,代码行数:7,代码来源:Permission.php

示例7: contains

 /**
  * {@inheritdoc}
  */
 public function contains($element)
 {
     $this->initialize();
     return $this->coll->contains($element);
 }
开发者ID:richardmiller,项目名称:mongodb-odm,代码行数:8,代码来源:PersistentCollection.php

示例8: hasExam

 /**
  * 
  * @param Exam $exam
  * @return boolean
  */
 function hasExam($exam)
 {
     return $this->exams->contains($exam);
 }
开发者ID:CATSInformatica,项目名称:CatsSys,代码行数:9,代码来源:ExamContent.php

示例9: retainAll

 /**
  * @see Collection_Mutable::retainAll() Collection_Mutable::retainAll()
  */
 public function retainAll(Collection $elements_)
 {
     $elements = [];
     foreach ($this->m_elements as $element) {
         if ($elements_->contains($element)) {
             array_push($elements, $element);
         }
     }
     $this->m_elements = $elements;
     $this->m_count = count($elements);
     if (false === isset($this->m_elements[$this->m_position])) {
         $this->previous();
     }
 }
开发者ID:evalcodenet,项目名称:net.evalcode.components.type,代码行数:17,代码来源:set.php

示例10: hasFavoritedBundle

 /**
  * Check that user has favorited bundles
  *
  * @param Bundle $bundle
  *
  * @return boolean
  */
 public function hasFavoritedBundle(Bundle $bundle)
 {
     return $this->favoriteBundles->contains($bundle);
 }
开发者ID:KnpLabs,项目名称:KnpBundles,代码行数:11,代码来源:Developer.php

示例11: hasChild

 /**
  * 
  * @param Subject $child
  * @return boolean
  */
 function hasChild($child)
 {
     return $this->children->contains($child);
 }
开发者ID:CATSInformatica,项目名称:CatsSys,代码行数:9,代码来源:Subject.php

示例12: contains

 /**
  * {@inheritdoc}
  */
 public function contains($element)
 {
     /* DRAFT
        if ($this->_initialized) {
            return $this->_coll->contains($element);
        } else {
            if ($element is MANAGED) {
                if ($this->_coll->contains($element)) {
                    return true;
                }
                $exists = check db for existence;
                if ($exists) {
                    $this->_coll->add($element);
                }
                return $exists;
            }
            return false;
        }*/
     $this->_initialize();
     return $this->_coll->contains($element);
 }
开发者ID:andreia,项目名称:doctrine,代码行数:24,代码来源:PersistentCollection.php

示例13: hasPromotion

 /**
  * {@inheritdoc}
  */
 public function hasPromotion(PromotionInterface $promotion)
 {
     return $this->promotions->contains($promotion);
 }
开发者ID:bcremer,项目名称:Sylius,代码行数:7,代码来源:OrderItem.php

示例14: retainAll

 public function retainAll(Collection $c)
 {
     $toRemove = array();
     foreach ($this as $element) {
         if (!$c->contains($element)) {
             $toRemove[] = $element;
         }
     }
     $this->removeArray($toRemove);
 }
开发者ID:google-code-backups,项目名称:gwtphp-derpc,代码行数:10,代码来源:collections.php

示例15: hasAttendance

 public function hasAttendance(Attendance $att)
 {
     return $this->attendances->contains($att);
 }
开发者ID:CATSInformatica,项目名称:CatsSys,代码行数:4,代码来源:Enrollment.php


注:本文中的Collection::contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。