/** * @covers BackBee\NestedNode\MediaFolder::__construct */ public function test__construct() { $this->assertInstanceOf('Doctrine\\Common\\Collections\\ArrayCollection', $this->keyword->getContent()); }
/** * @return Response * * @Rest\ParamConverter(name="keyword", class="BackBee\NestedNode\KeyWord") * @Rest\Security("is_fully_authenticated() & has_role('ROLE_API_USER')") */ public function deleteAction(KeyWord $keyword = null) { try { if (!$keyword) { throw new BadRequestHttpException('A keyword should be provided.'); } /* delete only if this keyword is not linked to a content */ if (!$keyword->getContent()->isEmpty()) { throw new BadRequestHttpException('KEYWORD_IS_LINKED'); } $this->getKeywordRepository()->delete($keyword); $response = $this->createJsonResponse(null, 204); } catch (\Exception $e) { $response = $this->createErrorResponse($e); } return $response; }