Skip to content

Commit

Permalink
Fix return type for getRelatedElementsQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Dec 10, 2022
1 parent 9337659 commit a70d44a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/services/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use craft\db\Query;
use craft\db\Table;
use craft\elements\Entry;
use craft\elements\db\ElementQueryInterface;
use craft\events\ConfigEvent;
use craft\fields\Matrix;
use craft\helpers\ArrayHelper;
Expand Down Expand Up @@ -1218,9 +1219,9 @@ public function getSupportedSiteIds(string $propagationMethod, ElementInterface
*
* @method getRelatedElements
* @param array|null $params Should contain 'relatedTo' but can also optionally include 'elementType' and 'criteria'
* @return SuperTableBlockElement
* @return ElementQueryInterface|null
*/
public function getRelatedElementsQuery(array $params = null): ?SuperTableBlockQuery
public function getRelatedElementsQuery(array $params = null): ?ElementQueryInterface
{
// Parse out the field handles
$fieldParams = explode('.', $params['relatedTo']['field']);
Expand Down
3 changes: 2 additions & 1 deletion src/variables/SuperTableVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace verbb\supertable\variables;

use Craft;
use craft\elements\db\ElementQueryInterface;

use verbb\supertable\SuperTable;
use verbb\supertable\elements\db\SuperTableBlockQuery;
Expand All @@ -20,7 +21,7 @@ public function blocks($criteria = null): SuperTableBlockQuery
return $query;
}

public function getRelatedElements($params = null): SuperTableBlockElement|SuperTableBlockQuery|null
public function getRelatedElements($params = null): ?ElementQueryInterface
{
return SuperTable::$plugin->getService()->getRelatedElementsQuery($params);
}
Expand Down

0 comments on commit a70d44a

Please sign in to comment.