public function deleteAction($id)
    {
        /** @var ContentManager $manager */
        $manager = $this->get('opifer.content.content_manager');
        $content = $manager->getRepository()->find($id);

        //generate new slug so deleted slug can be used again
        $hashedSlug = $content->getSlug().'-'.sha1(date('Y-m-d H:i:s'));

        $content->setSlug($hashedSlug);
        $manager->save($content);

        $manager->remove($content);

        return new JsonResponse(['success' => true]);
    }
public function deleteAction($id)
    {
        /** @var ContentManager $manager */
        $manager = $this->get('opifer.content.content_manager');
        $content = $manager->getRepository()->find($id);

        //generate new slug so deleted slug can be used again
        $hashedSlug = $content->getSlug().'-'.sha1(date('Y-m-d H:i:s'));

        $content->setSlug($hashedSlug);
        $manager->save($content);

        $manager->remove($content);

        return new JsonResponse(['success' => true]);
    }
public function deleteAction ( $ id ) { /** @var ContentManager $manager */ $ manager = $ this -> get ( 'opifer.content.content_manager' ) ; $ content = $ manager -> getRepository ( ) -> find ( $ id ) ; //generate new slug so deleted slug can be used again $ hashedSlug = $ content -> getSlug ( ) . '-' . sha1 ( date ( 'Y-m-d H:i:s' ) ) ; $ content -> setSlug ( $ hashedSlug ) ; $ manager -> save ( $ content ) ; $ manager -> remove ( $ content ) ; return new JsonResponse ( [ 'success' => true ] ) ; }
Delete content.

@param int $id

@return Response
Delete content .