Friday, February 12, 2016

Srange behaviour with find('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']);

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

No comments: