Closed Anubarak closed 6 months ago
The $value return value from $element->getFieldValue('superTableField') can be an instance of \craft\elements\Collection instead of craft\db\elements\ElementQuery
$value
$element->getFieldValue('superTableField')
\craft\elements\Collection
craft\db\elements\ElementQuery
https://github.com/verbb/super-table/blob/craft-4/src/fields/SuperTableField.php#L868
/** @var SuperTableBlockQuery|Collection $value */ $value = $element->getFieldValue($this->handle); // ... snip $value->setCachedResult($blocks);
your IDE should complain about this line as setCachedResult does not exist in a Collection. Could you please change this to
setCachedResult
Collection
if (!$allBlocksValidate && $value instanceof ElementQuery) { // Just in case the blocks weren't already cached $value->setCachedResult($blocks); }
Method craft\\elements\\ElementCollection::setCachedResult does not exist
4.X
3.0.12
No
No response
Fixed for the next release. To get this early, run composer require verbb/super-table:"dev-craft-4 as 3.0.12".
composer require verbb/super-table:"dev-craft-4 as 3.0.12"
Thank you very much 🙇
Fixed in 3.0.13
Describe the bug
The
$value
return value from$element->getFieldValue('superTableField')
can be an instance of\craft\elements\Collection
instead ofcraft\db\elements\ElementQuery
https://github.com/verbb/super-table/blob/craft-4/src/fields/SuperTableField.php#L868
your IDE should complain about this line as
setCachedResult
does not exist in aCollection
. Could you please change this toSteps to reproduce
Method craft\\elements\\ElementCollection::setCachedResult does not exist
Craft CMS version
4.X
Plugin version
3.0.12
Multi-site?
No
Additional context
No response