We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How do I express in this select volt?

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


3.3k
Accepted
answer
{{ select('productId', products, 'using': ['id', 'name'], 'useEmpty': true, 'emptyText': 'Please, choose one...', 'emptyValue': '@' ) }}

With products set in the controller

$this->view->setVar('products', Products::find("type = 'vegetables'"));