Skip to content

Commit

Permalink
Merge pull request #2604 from hethehe/patch-7
Browse files Browse the repository at this point in the history
make ObjectInterpreter compatible with "Advanced Many-To-Many Object Relation" Type
  • Loading branch information
dpfaffenbauer committed Apr 11, 2024
2 parents 36aff18 + c6f2bcb commit 7873569
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use CoreShop\Component\Index\Model\IndexableInterface;
use CoreShop\Component\Index\Model\IndexColumnInterface;
use Pimcore\Model\DataObject\AbstractObject;
use Pimcore\Model\DataObject\Data\ObjectMetadata;

class ObjectInterpreter implements RelationInterpreterInterface
{
Expand All @@ -30,6 +31,9 @@ public function interpretRelational(mixed $value, IndexableInterface $indexable,

if (is_array($value)) {
foreach ($value as $v) {
if ($v instanceof ObjectMetadata) {
$v = $v->getObject();
}
if ($v instanceof AbstractObject) {
$result[] = new RelationalValue($v->getId(), 'object');
}
Expand All @@ -47,6 +51,9 @@ public function interpret(mixed $value, IndexableInterface $indexable, IndexColu

if (is_array($value)) {
foreach ($value as $v) {
if ($v instanceof ObjectMetadata) {
$v = $v->getObject();
}
if ($v instanceof AbstractObject) {
$result[] = $v->getId();
}
Expand Down

0 comments on commit 7873569

Please sign in to comment.