当前位置: 首页>>代码示例>>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;未经允许,请勿转载。