本文整理汇总了PHP中Doctrine\Common\Collections\Collection::contains方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::contains方法的具体用法?PHP Collection::contains怎么用?PHP Collection::contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Common\Collections\Collection
的用法示例。
在下文中一共展示了Collection::contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeArticle
/**
* Remove articles
*
* @param Article $article
*/
public function removeArticle(Article $article)
{
if ($this->articles->contains($article)) {
$this->articles->removeElement($article);
$article->removeCitation($this);
}
}
示例2: removeItem
/**
* Remove item.
*
* @param \SWP\Component\Bridge\Model\Item $item
*/
public function removeItem(\SWP\Component\Bridge\Model\Item $item)
{
if ($this->items->contains($item)) {
$this->items->removeElement($item);
$item->setPackage(null);
}
}
示例3: 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);
}
示例4: removeArchivo
/**
* @param Archivo $archivo
*/
public function removeArchivo($archivo)
{
if ($this->archivos->contains($archivo)) {
$this->archivos->removeElement($archivo);
$archivo->setDocumentable(null);
}
}
示例5: removeEmpresa
/**
* @param Empresa $empresa
*/
public function removeEmpresa($empresa)
{
if ($this->empresas->contains($empresa)) {
$empresa->setDirector(null);
$this->empresas->removeElement($empresa);
}
}
示例6: addThirdParty
/**
* @param ThirdParty $thirdParty
*
* @return bool
*/
public function addThirdParty(ThirdParty $thirdParty)
{
if ($this->thirdPartyCredentials->contains($thirdParty)) {
return false;
}
return $this->thirdPartyCredentials->add($thirdParty);
}
示例7: addTag
/**
* Add tag
*
* @param TagInterface $tag Tag
*
* @return Product self Object
*/
public function addTag(TagInterface $tag)
{
if (!$this->tags->contains($tag)) {
$tag->addProduct($this);
$this->tags->add($tag);
}
return $this;
}
示例8: save
/**
* {@inheritdoc}
*/
public function save(TaskExecutionInterface $execution)
{
if ($this->taskExecutionCollection->contains($execution)) {
return $this;
}
$this->taskExecutionCollection->add($execution);
return $this;
}
示例9: syncNewAttributes
protected function syncNewAttributes(Collection $attributes)
{
$attributes->map(function (AttributeInterface $attribute) {
if (false === $this->attributes->contains($attribute)) {
$attribute->addValue($this);
}
});
}
示例10: save
/**
* {@inheritdoc}
*/
public function save(TaskInterface $task)
{
if ($this->taskCollection->contains($task)) {
return $this;
}
$this->taskCollection->add($task);
return $this;
}
示例11: addScene
/**
* @param Scene $scene
*
* @return Chapter
*/
public function addScene(Scene $scene)
{
if (!$this->scenes->contains($scene)) {
$scene->setChapter($this);
$this->scenes->add($scene);
}
return $this;
}
示例12: removeUser
/**
* @param User $user
*/
public function removeUser(User $user)
{
if (!$this->users->contains($user)) {
return;
}
$this->users->removeElement($user);
$user->removeGroup($this);
}
示例13: addChapter
/**
* @param Chapter $chapter
*
* @return Book
*/
public function addChapter(Chapter $chapter)
{
if (!$this->chapters->contains($chapter)) {
$this->chapters->add($chapter);
$chapter->setBook($this);
}
return $this;
}
示例14: removeUser
/**
* @param ApplicationUser $user
* @return bool
*/
public function removeUser(ApplicationUser $user)
{
$bResult = true;
if (!$this->users->contains($user)) {
$bResult = false;
}
$this->users->removeElement($user);
return $bResult;
}
示例15: addTravel
/**
* @param \Doctrine\Tests\Models\Cache\Travel $item
*/
public function addTravel(Travel $item)
{
if (!$this->travels->contains($item)) {
$this->travels->add($item);
}
if ($item->getTraveler() !== $this) {
$item->setTraveler($this);
}
}