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

  • SEARCH
  • Home
  • 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 6190527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:36:19+00:00 2026-05-24T02:36:19+00:00

Is there some magic in Symfony/doctrine with a model called JosVmOrderHistory? I have this

  • 0

Is there some magic in Symfony/doctrine with a model called JosVmOrderHistory?

I have this schema.yml excerpt:

JosVmOrder:
  tableName: jos_vm_orders
  columns:
    order_id: { type: integer(4), primary: true, autoincrement: true }
    user_id: { type: integer(4), notnull: true }
    vendor_id: { type: integer(4), notnull: true }
    order_number: { type: string(32), notnull: false }
    user_info_id: { type: string(32), notnull: false }
    order_total: { type: 'decimal(15, 5)', notnull: true }
    order_subtotal: { type: 'decimal(15, 5)', notnull: false }
    order_tax: { type: 'decimal(10, 2)', notnull: false }
    order_tax_details: { type: string(), notnull: true }
    order_shipping: { type: 'decimal(10, 2)', notnull: false }
    order_shipping_tax: { type: 'decimal(10, 2)', notnull: false }
    coupon_discount: { type: 'decimal(12, 2)', notnull: true }
    coupon_code: { type: string(32), notnull: false }
    order_discount: { type: 'decimal(12, 2)', notnull: true }
    order_currency: { type: string(16), notnull: false }
    order_status: { type: string(1), notnull: false }
    cdate: { type: integer(4), notnull: false }
    mdate: { type: integer(4), notnull: false }
    ship_method_id: { type: string(255), notnull: false }
    customer_note: { type: string(), notnull: true }
    ip_address: { type: string(15), notnull: true }
  relations:
    User: { class: JosUser, local: user_id, foreignAlias: OrderList }
    LatestVmOrderDetail: { class: LatestVmOrderDetail, local: order_id, foreign: order_id }

JosVmOrderHistory:
  tableName: jos_vm_order_history
  columns:
    order_status_history_id: { type: integer(4),primary: true, autoincrement: true }
    order_id: { type: integer(4) }
    order_status_code: { type: string(1) }
    date_added: { type: timestamp(25) }
    customer_notified: { type: integer(4), notnull: false }
    comments: { type: clob(16777777), notnull: false }
  relations:
    Order: { class: JosVmOrder, local: order_id, foreign: order_id }
    OrderStatus: { class: JosVmOrderStatus, local: order_status_code, foreign: order_status_code }

Firstly, the foreignAlias of JosVmOrderHistory is “JosVmOrderHistory”, not “JosVmOrderHistoryList” as I would have assumed.

Secondly, in model/doctrine/Order.class.php, I have the following function:

function getPaymentStatus(){

    $historyList = $this->getJosVmOrderHistory();
    if (count($historyList)){

        return $paymentStatus = $historyList[0];
    }else{
        return $paymentStatus = null;
    }
}

$historyList is always in descending order of order_status_history_id. I even added to model/doctrine/JosVmOrderHistoryTable.class.php:

public function createQuery($alias){

    return parent::createQuery($alias)->orderBy('order_status_history_id asc');


}

but it stays in descending order..

Edit: I’ve updated the subject – this problem seems to come down to how to control the OrderBy of a relation query. createQuery doesn’t seem to be called at all.

  • 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-24T02:36:21+00:00Added an answer on May 24, 2026 at 2:36 am

    If you need this for speed reasons you shouldnt load the entire order history from the DB if you are just interested in the first one, instead use a query like:

    function getPaymentStatus(){
    
        $historyList = Doctrine::getTable('JosVmOrderHistory')->createQuery()->where('order_id = ?', $this->order_id)->orderBy('order_status_history_id')->limit(1)->execute();
        if (count($historyList)){
    
            return $paymentStatus = $historyList[0];
        }else{
            return $paymentStatus = null;
        }
    }
    

    That being said, it is possible to automatically affect the sorting more like what you were trying to do by using a listener. In the past, I have created a generic sort behavior that you can use like:

      actAs:
        DefaultSort: { column: title }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there some magic existing code in MVC 2 to Html.Encode() strings and allow
Is there some magic required to obtain a zlib sync flush when using boost::iostreams::zlib_compressor
Is there some crucial difference in writing the registry class in MVC with magic
In SQL Server, is there some magic SQL I can preprend my SQL query
Where is the lib folder with the JAR's? Is there some magic to load
Maybe there's some magic I don't know about with scrolling on Android? I've got
There is some magic going on with WCF deserialization. How does it instantiate an
I have some misunderstanding of the processor register concepts. There is a register with
I want to have different start-page depending on if there is some settings stored
Are there some good resources tutorials or anyone has tried to implement a Capcha

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.