ArticleResource example

public function deleteProductAction()
    {
        $id = \is_null($this->Request()->getParam('Detail_id')) ? null : (int) $this->Request()->getParam('Detail_id');

        /** @var Detail $variant */
        $variant = $this->getDetailRepository()->find($id);
        if (!\is_object($variant)) {
            $this->View()->assign([
                'success' => false,
            ]);
        } else {
            $articleResource = new ArticleResource();
            $articleResource->setManager($this->get(ModelManager::class));

            if ($variant->getKind() == 1) {
                $articleResource->delete($variant->getArticle()->getId());
            } else {
                $this->get('models')->remove($variant);
            }

            $this->get('models')->flush();

            $this->View()->assign([
                
Home | Imprint | This part of the site doesn't use cookies.