Есть ли какое-то волшебство в Symfony / doctrine с моделью под названием JosVmOrderHistory?
У меня есть этот отрывок schema.yml:
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 }
Во-первых, чужеродные Алисии JosVmOrderHistory - это "JosVmOrderHistory", а не "JosVmOrderHistoryList", как я бы предположил.
Во-вторых, в модели / doctrine / Order.class.php у меня есть следующая функция:
function getPaymentStatus(){
$historyList = $this->getJosVmOrderHistory();
if (count($historyList)){
return $paymentStatus = $historyList[0];
}else{
return $paymentStatus = null;
}
}
$ historyList всегда вв порядке убывания order_status_history_id.Я даже добавил в модель / doctrine / JosVmOrderHistoryTable.class.php:
public function createQuery($alias){
return parent::createQuery($alias)->orderBy('order_status_history_id asc');
}
, но он остается в порядке убывания ..
Редактировать: я обновил тему - эта проблема кажетсясводится к тому, как управлять OrderBy запроса отношения.createQuery, похоже, вообще не вызывается.