У меня проблема с фильтрацией записей, я не хочу, чтобы у записей были пустые модели.
$this->paginate = array('fields' =>
array('DISTINCT Joborder.id',
'Joborder.job_type',
'Joborder.payment_status',
'Joborder.estimate_id',
'Joborder.quantity',
'Joborder.date_created'
),
'contain' => array(
'Workorder.id',
'Workorder.joborder_id',
'Joborderpart.id',
'Joborderpart.binding',
'Orderstatus.id',
'Estimate' => array(
'Client' => array(
'fields' => array(
'Client.company_name'
)
)
),
'Orderstatus' => array(
'fields' => array('Orderstatus.id'),
'order' => array(
'Orderstatus.id DESC'
),
'conditions' => array(
'Orderstatus.Orderstatustype_id LIKE' => 5
),
'Orderstatustype' => array(
'fields' => array(
'Orderstatustype.id',
'Orderstatustype.orderstatus'
)
),
'limit' => 1
)
)
);
Я проверил условие в таблице Orderstatus для выбора orderstatustype_id LIKE 5, который поставляется.
Мне нужны только записи об отправке, но все записи извлекаются, как показано ниже
Array
(
[0] => Array
(
[Joborder] => Array
(
[id] => 1
[job_type] => postcard
[payment_status] => Billed
[estimate_id] => 4
[quantity] =>
[date_created] => 2011-12-12
)
[Estimate] => Array
(
[id] => 4
[client_id] => 4
[custom_estimate] => 0
[custom_description] =>
[clientuser_id] => 40
[admin_id] => 3
[date_created] => 2012-01-01
[time_created] => 06:27:26 AM
[pricing_details] => 0
[wastesheet] => 12
[job_type] => postcard
[client_percentage] =>
[tax_rate] => 0.00
[Client] => Array
(
[company_name] => erte
)
)
[Workorder] => Array
(
[id] => 1
[joborder_id] => 1
)
[Joborderpart] => Array
(
[0] => Array
(
[id] => 1
[binding] => None
[joborder_id] => 1
)
)
[Orderstatus] => Array
(
)
)
[1] => Array
(
[Joborder] => Array
(
[id] => 2
[job_type] => asdf
[payment_status] =>
[estimate_id] => 5
[quantity] =>
[date_created] => 2011-10-12
)
[Estimate] => Array
(
[id] => 5
[client_id] => 4
[custom_estimate] => 0
[custom_description] =>
[clientuser_id] => 40
[admin_id] => 3
[date_created] => 2012-01-02
[time_created] => 06:29:03 AM
[pricing_details] => 0
[wastesheet] => 12
[job_type] => asdf
[client_percentage] =>
[tax_rate] => 0.00
[Client] => Array
(
[company_name] => erte
)
)
[Workorder] => Array
(
[id] => 2
[joborder_id] => 2
)
[Joborderpart] => Array
(
[0] => Array
(
[id] => 2
[binding] => None
[joborder_id] => 2
)
[1] => Array
(
[id] => 3
[binding] => None
[joborder_id] => 2
)
)
[Orderstatus] => Array
(
[0] => Array
(
[id] => 13
[orderstatustype_id] => 5
[joborder_id] => 2
[Orderstatustype] => Array
(
[id] => 5
[orderstatus] => Shipped
)
)
)
)
[2] => Array
(
[Joborder] => Array
(
[id] => 3
[job_type] => postcard
[payment_status] =>
[estimate_id] => 6
[quantity] =>
[date_created] => 2012-01-01
)
[Estimate] => Array
(
[id] => 6
[client_id] => 4
[custom_estimate] => 0
[custom_description] =>
[clientuser_id] => 40
[admin_id] => 3
[date_created] => 2012-01-03
[time_created] => 06:30:30 AM
[pricing_details] => 1
[wastesheet] => 12
[job_type] => postcard
[client_percentage] =>
[tax_rate] => 0.00
[Client] => Array
(
[company_name] => erte
)
)
[Workorder] => Array
(
[id] => 3
[joborder_id] => 3
)
[Joborderpart] => Array
(
[0] => Array
(
[id] => 4
[binding] => None
[joborder_id] => 3
)
[1] => Array
(
[id] => 5
[binding] => None
[joborder_id] => 3
)
)
[Orderstatus] => Array
(
)
)
)
Мне нужно отфильтровать только отправленные записи. Пожалуйста, помогите мне.