本文整理汇总了PHP中Doctrine\Common\Collections\Collection::removeElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::removeElement方法的具体用法?PHP Collection::removeElement怎么用?PHP Collection::removeElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Common\Collections\Collection
的用法示例。
在下文中一共展示了Collection::removeElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeArchivo
/**
* @param Archivo $archivo
*/
public function removeArchivo($archivo)
{
if ($this->archivos->contains($archivo)) {
$this->archivos->removeElement($archivo);
$archivo->setDocumentable(null);
}
}
示例2: removeOption
/**
* Remove a given option
*
* @param OptionInterface $option
* @return $this
*/
public function removeOption(OptionInterface $option)
{
if ($this->hasOption($option)) {
$this->options->removeElement($option);
}
return $this;
}
示例3: removeEmpresa
/**
* @param Empresa $empresa
*/
public function removeEmpresa($empresa)
{
if ($this->empresas->contains($empresa)) {
$empresa->setDirector(null);
$this->empresas->removeElement($empresa);
}
}
示例4: removeOption
/**
* @param AntiMattr\Common\Product\OptionInterface
*
* @throws OutOfBoundsException
*/
public function removeOption(OptionInterface $option)
{
$success = $this->options->removeElement($option);
if (!$success) {
throw new OutOfBoundsException('Variation::options do not contain option to remove');
}
}
示例5: removeTerm
/**
* {@inheritdoc}
*/
public function removeTerm(TermInterface $term)
{
if ($this->hasOption($term)) {
$this->terms->removeElement($term);
}
return $this;
}
示例6: 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);
}
}
示例7: removeArticle
/**
* Remove articles
*
* @param Article $article
*/
public function removeArticle(Article $article)
{
if ($this->articles->contains($article)) {
$this->articles->removeElement($article);
$article->removeCitation($this);
}
}
示例8: removeImage
/**
* {@inheritdoc}
*/
public function removeImage(TaxonImageInterface $image)
{
if ($this->hasImage($image)) {
$image->setTaxon(null);
$this->images->removeElement($image);
}
}
示例9: removeUser
/**
* @param User $user
*/
public function removeUser(User $user)
{
if (!$this->users->contains($user)) {
return;
}
$this->users->removeElement($user);
$user->removeGroup($this);
}
示例10: removeAttributeValue
/**
* Remove an attribute value
*
* @param AttributeValueInterface $attributeValue
*
* @return $this
*/
public function removeAttributeValue(AttributeValueInterface $attributeValue)
{
if ($this->attributeValues->contains($attributeValue)) {
$attributeValue->setSubject(null);
$this->attributeValues->removeElement($attributeValue);
}
return $this;
}
示例11: removeField
/**
* {@inheritdoc}
*/
public function removeField(FieldValueInterface $field)
{
if ($this->hasField($field)) {
$this->fields->removeElement($field);
$field->setSubject(null);
}
return $this;
}
示例12: synchronizeOptions
protected function synchronizeOptions(Collection $options)
{
$this->options->map(function (VariantOptionInterface $option) use($options) {
if (false === $options->contains($option)) {
$this->options->removeElement($option);
}
});
}
示例13: removeData
/**
* Removes data if set previously
*
* @param string $key
*
* @return boolean
*/
public function removeData($key)
{
$data = $this->findData($key);
if (isset($data)) {
$this->data->removeElement($data);
return true;
}
return false;
}
示例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: removeProduct
public function removeProduct(UuidIdentity $id)
{
$element = $this->lineItems->filter(function (LineItem $lineItem) use($id) {
return $lineItem->getProduct()->getId()->getValue() === $id->getValue();
})->first();
if ($element) {
$this->lineItems->removeElement($element);
}
return $this;
}