Backend\Modules\ContentBlocks\Repository\ContentBlockRepository::removeByIdAndLocale PHP Method

removeByIdAndLocale() public method

public removeByIdAndLocale ( integer $id, Locale $locale )
$id integer
$locale common\Locale
    public function removeByIdAndLocale($id, Locale $locale)
    {
        array_map(function (ContentBlock $contentBlock) {
            $this->getEntityManager()->remove($contentBlock);
        }, (array) $this->findBy(['id' => $id, 'locale' => $locale]));
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param DeleteContentBlock $deleteContentBlock
  *
  * @return ContentBlock
  */
 public function handle(DeleteContentBlock $deleteContentBlock)
 {
     $this->contentBlockRepository->removeByIdAndLocale($deleteContentBlock->contentBlock->getId(), $deleteContentBlock->contentBlock->getLocale());
     Model::deleteExtraById($deleteContentBlock->contentBlock->getExtraId());
 }