Orm 推进到条令代码段
我将symfony 1.4与ORM一起使用。我正在编辑一些操作,我需要将一个推进查询重写为原则。以下是片段:Orm 推进到条令代码段,orm,doctrine,symfony-1.4,propel,Orm,Doctrine,Symfony 1.4,Propel,我将symfony 1.4与ORM一起使用。我正在编辑一些操作,我需要将一个推进查询重写为原则。以下是片段: $c = new Criteria(); $c->add(BlogCommentPeer::BLOG_POST_ID, $request->getParameter('id')); $c->addAscendingOrderByColumn(BlogCommentPeer::CREATED_AT); $this->comments = BlogCo
$c = new Criteria();
$c->add(BlogCommentPeer::BLOG_POST_ID, $request->getParameter('id'));
$c->addAscendingOrderByColumn(BlogCommentPeer::CREATED_AT);
$this->comments = BlogCommentPeer::doSelect($c);
有人能帮忙转换吗?谢谢。在您的
blogcomentTable.php
文件中,使用以下方法:
public functoion retrieveByPostId($post_id)
{
$q = $this->createQuery('c')
->where('c.blog_post_id = ?', array($post_id))
->orderBy('c.created_at ASC');
return $q->execute();
}
在你的行动中:
$this->comments = Doctrine_Core::getTable('BlogComment')->retrieveByPostId($request->getParameter('id'));
哎呀。很抱歉这是一个新的概念,仍然在研究交战规则。