Merge string in attributes

If i need create a SELECT with authors ('id' as value and 'lastname' and 'firstname' as name) i use: {{ select('author', author, 'using': ['id', 'lastname']) }}

How i can merge lastname and firstname here? Construction with tilda didn't work: {{ select('author', author, 'using': ['id', 'lastname'~'firstname']) }}

Thanks!



82.7k

Create the query joining the lastname with the firstname:

$this->view->authors = 
       $this->modelsManager->createQuery()
           ->columns('id, CONCAT(lastname, " ", firstname) AS realname')
           ->from('Authors')

Then in the View: ```php {{ select('author', author, 'using': ['id', 'realname']) }} ```

Thanks!

This is solution that i use:

$this->view->authors = $this->modelsManager->createBuilder()
                ->columns(array("id", "CONCAT(lastname, ' ', firstname) AS fullname"))
                ->from('Application\Models\Users')
                ->getQuery()
                ->execute();