Stange behaviour with find('list')

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Stange behaviour with find('list')

CakePHP mailing list

i am using find('list') to get key/values and was very surprised that the key-values are wrong!?

if i use
  $corp = $SupplierCorps->find('list');
i get
    [22] => 10030000022
    [29] => 10030000029
where the key is the primaryKey defined in the Table-class and the value is the displayField.

This is ok but if  i use

$corp = $SupplierCorps->find('list', ['keyField' => 'SupplCorp_No_auto']);
where SupplCorp_No_auto is the displayField

i get this
    [1440065430] => 10030000022
    [1440065437] => 10030000029

and this is wrong!
The key should now the same as the value.
And if i run the sql against the mysql-Database i get the right results

Do i oversee something?

I use cakePhp 3.1.5

Thanks in advance,

Like Us on FaceBook
Find us on Twitter

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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at
For more options, visit