Hi. First, I see this topic: https://forum.phalcon.io/discussion/849/tag-setdefault-for-multiselect-checkbox-really-
But it not work in my case. I have Article and many categories for this article. (hasMany) I want set checkboxes cheked relation from data in db when I edit Article.
In view
<div class="form-group">
{% for category in categories %}
<div class="checkbox">
<label>
{{ check_field('categories_ids[]', 'value': category.id) }} {{category.title}}
</label>
</div>
{% endfor %}
</div>
In controller i trying to set like this:
$this->tag->setDefault("categories_ids[]", [1, 2]); // error: must be scalar
$this->tag->setDefaults(["categories_ids[]" => [3,4]]); // nothing
What I do wrong?