I have tried that but it didn't work. Right below are the codes for the
action.
public function dashboard_index() {
$this->_index(false);
}
public function admin_index()
{
$this->_index(true);
}
private function _index($isAdmin)
{
$conditions = array();
if(!$isAdmin)
{
$conditions = array($conditions, array("Trade.customer_id"
=> $this->Auth->user("id")));
}
//count all trades
$formMsCount = $this->Trade->find("count", array("conditions"
=> $conditions));
$this->set("formMsCount", $formMsCount);
debug($formMsCount);
$this->Paginator->settings = array(
"order" => "Trade.created DESC",
"conditions"=> $conditions,
"order" => 'Trade.form_m_id DESC',
'fields'=> array('Unit.*','FormM.name', 'Trade.*'),
'joins' => array(
array(
'table' => 'form_m',
'alias' => 'FormMJoin',
'type' => 'INNER',
'conditions' => array(
'FormMJoin.id = Trade.form_m_id'
)
),
array(
'table' => 'units',
'alias' => 'Unitn',
'type' => 'LEFT',
'conditions' => array(
'Trade.unit_id = Unitn.id'
)
),
));
$trades = $this->Paginator->paginate();
debug($trades);
$this->set('formMs', $trades);
}
On 10 November 2014 13:08, FabrÃcio Muniz <[email protected]> wrote:
> the log says:
>
> There's no join to the "Trade" table alias.
>
> Try to remove it from the "fields" key in your find().
> Em 10/11/2014 09:45, "Oluwasegun Adeleye Isaac" <[email protected]>
> escreveu:
>
>>
>> <https://lh3.googleusercontent.com/-XHn5cb1sZgo/VGCknXfpLqI/AAAAAAAAAgs/Nx0GREa1HoM/s1600/error.PNG>
>>
>>
>> Hi guys.
>>
>> I have been getting this error message on CakePHP and I cannot figure out
>> how to fix it.
>>
>> The table actually exists. Everything seems okay but the error persists.
>>
>> Please what can I do to fix it.
>>
>> Thanks
>>
>> --
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/cake-php.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "CakePHP" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/cake-php/CXd2L-AgnsM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.