本文整理汇总了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;
}
示例2: addRole
public function addRole(Role $role)
{
if (!$this->roles->contains($role)) {
$this->roles->add($role);
}
return $this;
}
示例3: addOrganization
public function addOrganization(OrganizationUser $organization)
{
$organization->addBeneficiary($this);
if (!$this->organizations->contains($organization)) {
$this->organizations->add($organization);
}
return $this;
}
示例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;
}
示例5: hasActivity
/**
* {@inheritdoc}
*/
public function hasActivity(ActivityInterface $activity)
{
return $this->activities->contains($activity);
}
示例6: hasChild
/**
* {@inheritdoc}
*/
public function hasChild(PermissionInterface $permission)
{
return $this->children->contains($permission);
}
示例7: contains
/**
* {@inheritdoc}
*/
public function contains($element)
{
$this->initialize();
return $this->coll->contains($element);
}
示例8: hasExam
/**
*
* @param Exam $exam
* @return boolean
*/
function hasExam($exam)
{
return $this->exams->contains($exam);
}
示例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();
}
}
示例10: hasFavoritedBundle
/**
* Check that user has favorited bundles
*
* @param Bundle $bundle
*
* @return boolean
*/
public function hasFavoritedBundle(Bundle $bundle)
{
return $this->favoriteBundles->contains($bundle);
}
示例11: hasChild
/**
*
* @param Subject $child
* @return boolean
*/
function hasChild($child)
{
return $this->children->contains($child);
}
示例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);
}
示例13: hasPromotion
/**
* {@inheritdoc}
*/
public function hasPromotion(PromotionInterface $promotion)
{
return $this->promotions->contains($promotion);
}
示例14: retainAll
public function retainAll(Collection $c)
{
$toRemove = array();
foreach ($this as $element) {
if (!$c->contains($element)) {
$toRemove[] = $element;
}
}
$this->removeArray($toRemove);
}
示例15: hasAttendance
public function hasAttendance(Attendance $att)
{
return $this->attendances->contains($att);
}