Closed ClaudeMa closed 10 years ago
Are you using the absolute most recent. Someone reported a bug with CakePHP 2.4.1 and pushed a fix about a week or so ago. It has to do with how cake handles limits in MySQL. Let me know. Thanks.
Also I notice in your paginate configuration you are referencing multiple tables in the 'fields' list:
Nature,Statut,Concerne,Urgence,Ticket,User
You need to tell paginate you are joining on these tables with something like this mock code:
if($this->RequestHandler->responseType() == 'json') {
$this->paginate = array(
'fields' => array('Ticket.id','Ticket.created','Ticket.titre'),
'link' => array(
'Nature' => array(
'fields' => array(
'nature'
)
),
'Statut' => array(
'fields' => array(
'statut'
)
)
)
);
$this->DataTable->fields = array('Ticket.id','Ticket.created','Ticket.titre', 'Nature.nature', 'Statut.statut', 'Concerne.nom','Urgence.urgence','Ticket.modified', 'User.username', 'Statut.couleur');
$this->DataTable->emptyElements = 1;
$this->set('tickets', $this->DataTable->getResponse());
$this->set('_serialize','tickets');
}
Also I've had problems using the emptyElements property, please read previous closed issues as they often answer your questions....
Closed due to lack of response
Controller work fine with version 1.1.0 Upgrading to 1.1.1 give internal server error 500 with
"error":{"errorInfo":["42S22",1054,"Unknown column 'Nature.nature' in 'field list'"],"queryString":"SELECT
Ticket
.id
,Ticket
.created
,Ticket
.titre
,Nature
.nature
,Statut
.statut
,Concerne
.nom
,Urgence
.urgence
,Ticket
.modified
,User
.username
,Statut
.couleur
FROMefpad
.tickets
ASTicket
WHERE 1 = 1 ORDER BYConcerne
.nom
ASC LIMIT 0"}} returning to previous version solve errormy controler code:
public function index() {
my model code
<?php // app/Model/Ticket.php class Ticket extends AppModel { public $name = 'Ticket'; public $actsAs = array('Linkable','Containable'); public $displayField = 'ticket'; public $belongsTo = array( 'Groupe' => array( 'className' => 'Groupe', 'foreignKey'=> 'groupe_id' ), 'User' => array( 'className' => 'User', 'foreignKey'=> 'user_id' ), 'Concerne' => array( 'className' => 'Concerne', 'foreignKey'=> 'concerne_id' ), 'Nature' => array( 'className' => 'Nature', 'foreignKey'=> 'nature_id' ), 'Urgence' => array( 'className' => 'Urgence', 'foreignKey'=> 'urgence_id' ), 'Statut' => array( 'className' => 'Statut', 'foreignKey'=> 'statut_id' ), );
Cakephp 2.4.1 PHP Version 5.4.4-14+deb7u5 Apache2 Api version 20051115 Debian Wheezy x86_64