oliverdavies.uk/web/modules/custom/talks/src/Collection/TalkCollection.php
Oliver Davies cae2091436 build(deps): remove discoverable_entity_bundle_classes
As this module is no longer supported, remove it from the codebase and
update all references to it within the custom code - instead manually
wrapping nodes with the `Post` or `Talk` class, or returning it from a
Repository.

Fixes: #465
2021-12-17 23:05:41 +00:00

24 lines
533 B
PHP

<?php
declare(strict_types=1);
namespace Drupal\opdavies_talks\Collection;
use Drupal\node\NodeInterface;
use Drupal\opdavies_talks\Entity\Node\Talk;
use Drupal\paragraphs\ParagraphInterface;
use Illuminate\Support\Collection;
final class TalkCollection extends Collection {
/**
* Return the events for the talks in the Collection.
*
* @return Collection|ParagraphInterface[]
*/
public function getEvents(): Collection {
return $this
->flatMap(fn(Talk $talk): Collection => $talk->getEvents());
}
}