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

Select option in Volt

Hi @all,

i have little problems to understand the docu of phalcon.

I want to create an select option and I am using volt for it.

In the docu I found this:

{{ select("type", productTypes, 'using': ['id', 'name']) }}

It is here:

https://docs.phalcon.io/en/latest/reference/volt.html

Where do the id, name and productTypes comes from? Where do i create them? And how?

Sorry, but i am an absolutely beginner to phalcon.

Rgds

Stefan

You have to pass productTypes as a variable in the controller, id and name are attributes present in the model.

public function viewAction()
{
    $this->view->productTypes = ProductTypes::find();
}