Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Merging with model data in select

Hi all.

How to merge model data with another array? For example:

//Can be static array
$vegetables = array('id' => 999, 'name' => 'Potato');

echo $this->tag->select(
        Products::find("type = 'vegetables'"),
        'using' => array('id', "name"),
        'useEmpty' => true,
        'emptyText' => 'Please, choose one...',
        'emptyValue' => '@'

<select id="productId" name="productId">
    <option value="@">Please, choose one..</option>
    <option value="101">Tomato</option>
    <option value="102">Lettuce</option>
    <option value="103">Beans</option>
    <option value="999">Potato</option>


You can try:

array_merge($vegetables , Products::find("type = 'vegetables'")->toArray())