Hot answers tagged

2

Ok so here's how I ended up doing this. Essentially querying everything and adding a sourceId and targetId property to each result. In order to get this query to work though, we need to add a behavior to the Entry component to support two new properties, sourceId and targetId. // This basically left-joins the the relationship table to our sections. This ...


2

What an idiot. I almost never use Advanced element queries which is why it never popped into my head I guess. So you can add where() and orWhere() into your standard craft.entries calls. So my code becomes {% if craft.app.request.getParam('departure') | length %} {% for dept in craft.app.request.getParam('departure') %} {% set lastDay = dept [0:7]...


1

Prepending the field name with field: should do the trick. <?php return [ [ 'sectionId' => $this->sectionIds['locations'], 'typeId' => $this->typeIds['locations']['locations'], 'title' => 'Location 1', 'field:gmbId' => '123', ], ]; See https://github.com/craftcms/cms/blob/develop/tests/fixtures/...


1

For future reference of anybody stumbling onto this post (like me), setting ->typeId works for like 90%, but to cover it all put this in it too: $entry->fieldLayoutId = null; If you don't throw the field layout out, it might still hold on to the old fields of the entry. This gives some really weird issues, like a relational field being filled in the ...


Only top voted, non community-wiki answers of a minimum length are eligible