2021-02-10 07:54:43 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Drupal\opdavies_talks\Collection;
|
|
|
|
|
2021-12-17 15:16:52 +00:00
|
|
|
use Drupal\node\NodeInterface;
|
2021-02-10 07:54:43 +00:00
|
|
|
use Drupal\opdavies_talks\Entity\Node\Talk;
|
|
|
|
use Drupal\paragraphs\ParagraphInterface;
|
2021-04-23 08:58:14 +01:00
|
|
|
use Illuminate\Support\Collection;
|
2021-02-10 07:54:43 +00:00
|
|
|
|
|
|
|
final class TalkCollection extends Collection {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the events for the talks in the Collection.
|
|
|
|
*
|
|
|
|
* @return Collection|ParagraphInterface[]
|
|
|
|
*/
|
|
|
|
public function getEvents(): Collection {
|
2021-12-17 15:16:52 +00:00
|
|
|
return $this
|
|
|
|
->flatMap(fn(Talk $talk): Collection => $talk->getEvents());
|
2021-02-10 07:54:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|