Thursday, February 18, 2016

Re: Srange behaviour with find('list')

Hello michael,

Check your displayField in the respective table file. If it is different from what you are trying to fetch then just add your field in the displayField just above the find query.

On Thursday, February 18, 2016 at 1:48:22 AM UTC+5:30, Michael Kornatzki wrote:
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

--
We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon.
 
Like Us on FaceBook https://www.facebook.com/CakePHP
Follow 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.
For more options, visit https://groups.google.com/d/optout.

No comments: