Stange behaviour with find('list')

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Stange behaviour with find('list')

CakePHP mailing list
Hi,

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');
  Log::debug($corp->toArray());
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,
michael

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
Loading...