Add an Event bundle class
This commit is contained in:
parent
f56eb931c2
commit
14cd79a960
6 changed files with 49 additions and 14 deletions
|
|
@ -4,20 +4,20 @@ declare(strict_types=1);
|
|||
|
||||
namespace Drupal\opd_presentations\Collection;
|
||||
|
||||
use Drupal\paragraphs\ParagraphInterface;
|
||||
use Drupal\opd_presentations\Entity\Event;
|
||||
|
||||
/**
|
||||
* @implements \IteratorAggregate<ParagraphInterface>
|
||||
* @implements \IteratorAggregate<Event>
|
||||
*/
|
||||
readonly final class EventCollection implements \IteratorAggregate {
|
||||
|
||||
/**
|
||||
* @param ParagraphInterface[] $events
|
||||
* @param Event[] $events
|
||||
*/
|
||||
public function __construct(private array $events) {
|
||||
}
|
||||
|
||||
public function first(): ParagraphInterface {
|
||||
public function first(): Event {
|
||||
return array_values($this->events)[0];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue