Skip to content

Commit

Permalink
Add the root item to the event
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Jan 29, 2025
1 parent 6a88138 commit cbb6a9a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Event/GenerateBatchItemEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@ final class GenerateBatchItemEvent
/** @var object|array */
private $item;

private ?object $rootItem;

/**
* @param object|array $item
*/
public function __construct(FeedInterface $feed, FeedTypeInterface $feedType, ChannelInterface $channel, LocaleInterface $locale, $item)
public function __construct(FeedInterface $feed, FeedTypeInterface $feedType, ChannelInterface $channel, LocaleInterface $locale, $item, object $rootItem = null)
{
$this->feed = $feed;
$this->feedType = $feedType;
$this->channel = $channel;
$this->locale = $locale;
$this->item = $item;
$this->rootItem = $rootItem;
}

public function getFeed(): FeedInterface
Expand Down Expand Up @@ -61,4 +64,9 @@ public function getItem()
{
return $this->item;
}

public function getRootItem(): ?object
{
return $this->rootItem;
}
}
1 change: 1 addition & 0 deletions src/Message/Handler/GenerateBatchHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public function __invoke(GenerateBatch $message): void
$channel,
$locale,
$context,
$item,
));

$constraintViolationList = $this->validator->validate(
Expand Down

0 comments on commit cbb6a9a

Please sign in to comment.