propel pseudo column sorting

前端 未结 2 395
无人及你
无人及你 2021-01-26 19:58

Basically I want to make a pseudo column by which I\'ll sort. This is my SQL Query

SELECT I.*, ((I.width*175)/I.height) as relativeWidth
FROM Image I
order by r         


        
2条回答
  •  借酒劲吻你
    2021-01-26 20:38

    Such requirements are possible in version 1.5+ of Propel. You are strongly encouraged to upgrade since it is fully backwards-compatible, with a lot of new features and fixes.

    You just need to learn about the new ActiveQuery api instead of the ol' good Criteria. That way you can solve your problem using "virtual columns", just look here: http://www.propelorm.org/reference/model-criteria.html#adding_columns

    If you are using Propel inside symfony, just install the sfPropelORMPlugin from https://github.com/propelorm/sfPropelORMPlugin and follow the README file to get it working.

    Good luck!

提交回复
热议问题