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
Related Tags
entries × 915templating × 119
categories × 90
plugin-development × 65
relations × 62
structure × 54
craft3 × 52
search × 41
assets × 38
matrix × 36
datetime × 34
sections × 34
control-panel × 31
field × 26
filter × 25
ordering × 25
pagination × 22
users × 21
form × 21
url × 21
elementcriteriamodel × 21
entries-field × 21
localization × 20
entry × 20
sorting × 20