當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Post::getId方法代碼示例

本文整理匯總了PHP中AppBundle\Entity\Post::getId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Post::getId方法的具體用法?PHP Post::getId怎麽用?PHP Post::getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AppBundle\Entity\Post的用法示例。


在下文中一共展示了Post::getId方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: delete

 /**
  * @return int
  */
 public function delete(User $user, Post $post)
 {
     $conn = $this->_em->getConnection();
     $statement = $conn->prepare('DELETE FROM post_vote WHERE user_id = :user_id AND post_id = :post_id');
     $statement->bindValue('user_id', $user->getId());
     $statement->bindValue('post_id', $post->getId());
     return $statement->execute();
 }
開發者ID:matheusgontijo,項目名稱:MageBrazuca,代碼行數:11,代碼來源:PostVoteRepository.php

示例2: upload

 protected function upload(Post $entity)
 {
     if (null === $entity->getFile()) {
         return;
     }
     // check if we have an old image
     if (null !== $entity->getTemp()) {
         // delete the old image
         unlink($entity->getTemp());
         // clear the temp image path
         $entity->setTemp(null);
     }
     $entity->getFile()->move($entity->getUploadRootDir() . '/' . $entity->getId(), $entity->getImageName() . '.' . $entity->getFile()->guessExtension());
     $entity->setFile(null);
 }
開發者ID:Wolframcheg,項目名稱:symfonyblog,代碼行數:15,代碼來源:DoctrineEventSubscriber.php

示例3: createDeleteForm

 /**
  * Creates a form to delete a Post entity by id.
  *
  * This is necessary because browsers don't support HTTP methods different
  * from GET and POST. Since the controller that removes the blog posts expects
  * a DELETE method, the trick is to create a simple form that *fakes* the
  * HTTP DELETE method.
  * See http://symfony.com/doc/current/cookbook/routing/method_parameters.html.
  *
  * @param Post $post The post object
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(Post $post)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('super_admin_post_delete', array('id' => $post->getId())))->setMethod('DELETE')->getForm();
 }
開發者ID:quangtuanle,項目名稱:alano_project,代碼行數:17,代碼來源:BlogController.php

示例4: createPostDeleteForm

 public function createPostDeleteForm(Post $post)
 {
     //$builder = $this->formFactory->createBuilder();
     $form = $this->builder->setAction($this->router->generate('remove_post', array('id' => $post->getId())))->setMethod('DELETE')->add('submit', SubmitType::class, ['label' => ' ', 'attr' => ['class' => 'glyphicon glyphicon-trash btn-link']])->getForm();
     return $form;
 }
開發者ID:maximzh,項目名稱:Blog,代碼行數:6,代碼來源:FormManager.php

示例5: updateTotalVotes

    public function updateTotalVotes(Post $post)
    {
        $conn = $this->getEntityManager()->getConnection();
        $sql = '
        UPDATE
            post

        LEFT JOIN (
            SELECT post_id, COUNT(*) AS total FROM post_vote WHERE post_id = :post_id_1
        ) AS upvote ON upvote.post_id = post.id

        SET
            upvote_total = upvote.total

        WHERE
            post.id = :post_id_2
	    ';
        $statement = $conn->prepare($sql);
        if ($post->getId()) {
            $statement->bindValue('post_id_1', $post->getId());
            $statement->bindValue('post_id_2', $post->getId());
        }
        return $statement->execute();
    }
開發者ID:matheusgontijo,項目名稱:MageBrazuca,代碼行數:24,代碼來源:PostRepository.php

示例6: createDeleteForm

 /**
  * 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('admin_post_delete', array('id' => $post->getId())))->setMethod('DELETE')->add('submit', SubmitType::class, ['label' => ' ', 'attr' => ['class' => 'btn btn-xs btn-danger ace-icon fa fa-trash-o bigger-120']])->getForm();
 }
開發者ID:0TshELn1ck,項目名稱:blog,代碼行數:11,代碼來源:PostController.php

示例7: getPostId

 /**
  * @return int|null
  *
  * @Serializer\VirtualProperty()
  */
 public function getPostId()
 {
     return null !== $this->post ? $this->post->getId() : null;
 }
開發者ID:amine2233,項目名稱:api-ng-admin-tutorial,代碼行數:9,代碼來源:Comment.php

示例8: getId

 /**
  * {@inheritDoc}
  */
 public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) parent::getId();
     }
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array());
     return parent::getId();
 }
開發者ID:KaanTolunayKilic,項目名稱:miniBlog,代碼行數:11,代碼來源:__CG__AppBundleEntityPost.php

示例9: createDeleteForm

 /**
  * 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('_delete', array('id' => $post->getId())))->setMethod('DELETE')->getForm();
     return json_encode($post->getId());
     //for json
 }
開發者ID:OxanaKozlova,項目名稱:blog_symfony,代碼行數:13,代碼來源:PostController.php


注:本文中的AppBundle\Entity\Post::getId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。