/** * Creates a form to delete a Post entity. * * @param Post $post The Post entity * * @return \Symfony\Component\Form\Form The form */ private function createDeleteForm(Post $post) { return $this->createFormBuilder()->setAction($this->generateUrl('post_delete', array('id' => $post->getId())))->setMethod('DELETE')->getForm(); }
private function canEdit(Post $post, Users $user) { // this assumes that the data object has a getOwner() method // to get the entity of the user who owns this data object return $user === $post->getUser(); }