本文整理汇总了PHP中Doctrine\Common\Collections\ArrayCollection::contains方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayCollection::contains方法的具体用法?PHP ArrayCollection::contains怎么用?PHP ArrayCollection::contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Common\Collections\ArrayCollection
的用法示例。
在下文中一共展示了ArrayCollection::contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addManager
/**
* @param BreadcrumbManagerInterface $manager
*/
public function addManager(BreadcrumbManagerInterface $manager)
{
if ($this->managers->contains($manager)) {
return;
}
$this->managers->add($manager);
}
示例2: addEvent
/**
* If the event isn't already in the list, add it
*
* @param CalendarEventInterface $event
* @return CalendarEvent $this
*/
public function addEvent(CalendarEventInterface $event)
{
if (!$this->events->contains($event)) {
$this->events->add($event);
}
return $this;
}
示例3: addTranslation
/**
* {@inheritdoc}
*/
public function addTranslation(AbstractTranslation $translation)
{
if (!$this->translations->contains($translation)) {
$this->translations->add($translation);
}
return $this;
}
示例4: addTag
/**
* Add tag
*
* @param Tag $tag
*
* @return Item
*/
public function addTag($tag)
{
if ($this->tags->contains($tag) === false) {
$this->tags[] = $tag;
}
return $this;
}
示例5: reverseTransform
/**
* Transforms a string (ftags) to an array of entities ($tags_arraytag).
*
* @param string $ftags
* @return array
*/
public function reverseTransform($ftags)
{
if (!$ftags) {
$ftags = '';
// default
}
$tags_arraytag = new ArrayCollection();
$tags_arraystring = explode(",", $ftags);
foreach ($tags_arraystring as $i => $tag_string) {
// On vérifie si le tag est déjà dans la DB
$issue = $this->om->getRepository('HeliosBlogBundle:Tag')->findOneByTag($tag_string);
if (null === $issue) {
$itag = new Tag();
$itag->setTag($tag_string);
if (!$tags_arraytag->contains($itag)) {
$tags_arraytag[$i] = $itag;
}
} else {
if (!$tags_arraytag->contains($issue->getTag())) {
$tags_arraytag[$i] = $issue;
}
}
}
return $tags_arraytag;
}
示例6: add
/**
* @param Ignored $ignored
*
* @return IgnoredRepository
*/
public function add(Ignored $ignored)
{
if (!$this->ignores->contains($ignored)) {
$this->ignores->add($ignored);
}
return $this;
}
示例7: removePost
public function removePost(Post $post)
{
if ($this->posts->contains($post)) {
$this->posts->removeElement($post);
}
return $this;
}
示例8: addVariantChild
/**
* Add variant
*
* @param VariantEntityInterface $child
*
* @return $this
*/
public function addVariantChild(VariantEntityInterface $child)
{
if (!$this->variantChildren->contains($child)) {
$this->variantChildren[] = $child;
}
return $this;
}
示例9: addProvider
/**
* @param ProviderInterface $provider
*
* @return $this
*/
public function addProvider(ProviderInterface $provider)
{
if (!$this->providers->contains($provider)) {
$this->providers->set($provider->getName(), $provider);
}
return $this;
}
示例10: addVariant
/**
* @param Variant $variant
* @return \Ekyna\Component\Characteristics\Tests\Fixtures\Product
*/
public function addVariant(Variant $variant)
{
if (!$this->variants->contains($variant)) {
$this->variants->add($variant);
}
return $this;
}
示例11: addMovie
/**
* @param Movie $m
*/
public function addMovie(Movie $m)
{
if (!$this->movies->contains($m)) {
$this->movies->add($m);
$m->addDirector($this);
}
}
示例12: addProvider
/**
* @param OwnerTreeProviderInterface $provider
*/
public function addProvider(OwnerTreeProviderInterface $provider)
{
if ($this->providers->contains($provider)) {
return;
}
$this->providers->add($provider);
}
示例13: addClass
/**
* @param string $class
* @return SupportedClassPool
*/
public function addClass(string $class) : self
{
if (!$this->classes->contains($class)) {
$this->classes->add($class);
}
return $this;
}
示例14: addTranslationChild
/**
* Add translation.
*
* @param TranslationEntityInterface $translationChildren
*
* @return $this
*/
public function addTranslationChild(TranslationEntityInterface $child)
{
if (!$this->translationChildren->contains($child)) {
$this->translationChildren[] = $child;
}
return $this;
}
示例15: removeParcelResponse
/**
* @return $this
*/
public function removeParcelResponse(ParcelResponse $parcelResponse)
{
if ($this->parcelResponses->contains($parcelResponse)) {
$this->parcelResponses->removeElement($parcelResponse);
}
return $this;
}