Ojs\JournalBundle\Entity\Block::getId PHP Method

getId() public method

Get id
public getId ( ) : integer
return integer
    public function getId()
    {
        return $this->id;
    }

Usage Example

Beispiel #1
0
 /**
  * Deletes a Block entity.
  *
  * @param  Request          $request
  * @param  Block            $entity
  * @return RedirectResponse
  *
  *
  */
 public function deleteAction(Request $request, Block $entity)
 {
     $journal = $this->get('ojs.journal_service')->getSelectedJournal();
     if (!$this->isGranted('DELETE', $journal, 'block')) {
         throw new AccessDeniedException("You not authorized for delete this page!");
     }
     $em = $this->getDoctrine()->getManager();
     $csrf = $this->get('security.csrf.token_manager');
     $token = $csrf->getToken('ojs_journal_block' . $entity->getId());
     if ($token != $request->get('_token')) {
         throw new TokenNotFoundException("Token Not Found!");
     }
     $this->get('ojs_core.delete.service')->check($entity);
     $em->remove($entity);
     $em->flush();
     $this->successFlashBag('successful.remove');
     return $this->redirectToRoute('ojs_journal_block_index', ['journalId' => $journal->getId()]);
 }