Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6771015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:22:56+00:00 2026-05-26T15:22:56+00:00

Can/should One use any ORM Solution is a Complex Situation like this ? can

  • 0

Can/should One use any ORM Solution is a Complex Situation like this ?
can this even be done with Propel or Doctrine ? at the moment I am using Propel. So I’d be glad If there is Propel solution for it.
If I do a direct query with propel what are the suggestion ?

SELECT I.*,((I.width*175)/I.height) as relativeWidth FROM 
(SELECT * FROM Image WHERE owner = 1 LIMIT 5, 10) I
order by relativeWidth asc

and additionally What is the standard solution for the scenario where one needs to exequte really complex queries in most of the places in the application ?

There is a LIMIT 5, 10 that I use for Pagination. and its in inner Query. If its in View how can I control Pagination ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:22:57+00:00Added an answer on May 26, 2026 at 3:22 pm

    Your query can be written as following with Propel 1.6.3:

    <?php
    
    // SELECT * FROM Image WHERE owner = 1 LIMIT 5, 10
    $subQuery = ImageQuery::create()
        ->filterByOwner(1)
        ->limit(10)
        ->offset(5)
        ;
    
    $query = ImageQuery::create()
        ->addSelectQuery($subQuery, 'I', true)
        ->withColumn('((I.WIDTH*175)/I.HEIGHT)', 'relativeWidth') // ((I.width*175)/I.height) as relativeWidth
        ->orderBy('relativeWidth') // default is 'asc'
        ;
    
    $params = array();
    var_dump(\BasePeer::createSelectSql($query, $params));
    

    Output is:

    SELECT I.ID, I.WIDTH, I.HEIGHT, I.OWNER, ((I.WIDTH*175)/I.HEIGHT) AS relativeWidth
    FROM (
        SELECT image.ID, image.WIDTH, image.HEIGHT, image.OWNER
        FROM `image`
        WHERE image.OWNER=:p1 LIMIT 5, 10
    ) AS I
    ORDER BY relativeWidth ASC
    

    Note the :p1 is the binding parameter related to the owner value.

    So it’s really easy to create complex queries using Propel 🙂

    William

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does it matter? Should I use one or the other? Or both, even? Can
Hey can any one tell me should i need open a port for outgoing
How can I force validation when user clicks button? One would think this should
Can/Should I use a LIKE criteria as part of an INNER JOIN when building
How should be implemented facultative one-to-one relation in Doctrine ORM and Symfony? Suppose there
Is there any reasonable use case, where one should use const pointer over reference?
Can anyone please tell me when should I use MessageContracts and when should I
This should be totally simple but I can't get it working no matter what
When using a boost::asio::ip::tcp:socket there are many methods one can use to write/send data.
One can use typeof to determine whether a value is primitive or boxed. Consider:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.