docs: DrupalCon updates

This commit is contained in:
Oliver Davies 2023-10-17 10:36:46 +02:00
parent 6cf7d0fee4
commit 675e89e9d1
28 changed files with 1240 additions and 144 deletions

View file

@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace Drupal\drupalcon\Repository;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\node\NodeInterface;
final class ArticleRepository {
private EntityStorageInterface $nodeStorage;
public function __construct(
private EntityTypeManagerInterface $entityTypeManager,
) {
$this->nodeStorage = $this->entityTypeManager->getStorage('node');
}
// start code
public function getAll(): array {
return $this->nodeStorage->loadByProperties([
'status' => NodeInterface::PUBLISHED,
]);
}
// end code
}
// start output
.. 2 / 2 (100%)
Time: 00:00.891, Memory: 6.00 MB
OK (2 tests, 22 assertions)
// end output