I'm trying to put a select box into my form that has the value of the base table id, but the option text is the concatenation of the base table id and two other fields from two tables related by a couple of intermediator tables as follows:
$this->view->setVar("projects", Projects::find(array( 'conditions' => 'phase_id < 8', 'columns' => 'id, ' . new \Phalcon\Db\RawValue('CONCAT(id, " - ", Sites.Client.name, ", ", Sites.Address.city) AS dropdown'), 'order' => 'id DESC' )));
Now based on the fact that when I run this I get the following error, I'm assuming that it's not possible:
Syntax error, unexpected token DOT, near to 'name, ", ", Sites.Addresses.city) AS dropdown FROM [my-app\Models\PmsProjects] WHERE phaseid < 8 ORDER BY id DESC', when parsing: SELECT id, CONCAT(id, " - ", Sites.Client.name, ", ", Sites.Addresses.city) AS dropdown FROM [my-app\Models\PmsProjects] WHERE phaseid < 8 ORDER BY id DESC (160)
My question is: is there a way to achieve this using the ::find() or do i need to build the query up manually and then pass this to the tag helper?
Just looking for confirmation.
Thanks in advance.