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.

Phalcon\Assets\Collection need method __toString()

Hi evryone,

I woudlike to minify all js scripts ( but I'dlike to add js file in views not in controllers. In my layout I use:

        {{ assets
            .addJs('//', false, false)
            .addJs('//', false, false)

but Phalcon\Assets\Collection doesn't have __toString() method so in console I have:

[Wed, 10 Dec 14 13:24:58 +0100][ERROR] Object of class Phalcon\Assets\Collection could not be converted to string | on line: 29 | in file: /home/****/_apps_common_frontend.volt.php | [4096]

When I use native php, evrythink work fine


I use the following in head section and it works

{% do assets.collection('headJs').addJs('js/jquery.min.js') %}
{% do assets.collection('headJs').addJs('js/semantic.min.js') %}
{{ assets.outputJs('headJs') }}


magic word "do"