【问题标题】:How to perform SQL query using Popel ORM in Symfony如何在 Symfony 中使用 Popel ORM 执行 SQL 查询
【发布时间】:2010-11-29 02:13:36
【问题描述】:

这是我的问题, 我正在尝试在 symfony 中做标签云,我想要执行的是这样一个 sql 查询

select tag, count(tag) from tagi group by tag order by count(tag) desc limit 10

有人可以帮忙吗?

【问题讨论】:

    标签: sql orm symfony1 propel


    【解决方案1】:

    在 Peer(不是 BasePeer)类中创建一个映射到“标签”表的函数。示例:

    public static function doGetTags() {
    
        $connection = Propel::getConnection();
        // get the query from configuration
        $query = sfConfig::get('app_query_tags_all');
        $statement = $connection->prepare($query);
        $statement->execute();
        $results = self::populateObjects($statement);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-08
      • 2018-12-05
      • 2013-12-13
      • 2018-08-03
      • 2015-06-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多