<?= $this->Form->input('searchname', ['options' => $accountsArray, 'default' => '00', 'label' => ' ', 'id' => 'account','class' => 'smallField', 'rel' => $costurl]);
Error:
Warning (2): array_merge(): Argument #2 is not an array [APP/Template\Element\searchAccount.ctp, line 6]
The Selection-Field shows only the „00“.
How do I manage to set an additional Entry on top oft the list?
The former calls toArray, but does nothing with the results, so what you return from the function is still a query object, not an array. The latter returns the array, so that it’s what the array_merge call expects.
To debug things like this, when it tells you that argument 2 isn’t an array, you might use gettype right before the array_merge call, and then when that tells you that it’s an object call get_class. Then you’d know it’s a query object, and that helps point you in the right direction to solve it.
Hi folks, ad thanks for your reply. I have made it with the “return … ->toArray()” solution. I was not aware of the difference what is returned. Thanks again.