4m: Return a Post rather than a node

This commit is contained in:
Oliver Davies 2020-11-14 09:56:17 +00:00
parent 9aec327945
commit 259f077f61

View file

@ -3,6 +3,7 @@
namespace Drupal\my_module\Repository;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\my_module\Entity\Post;
use Drupal\node\NodeInterface;
class ArticleRepository {
@ -21,7 +22,9 @@ class ArticleRepository {
$this->sortByCreatedDate($articles);
return $articles;
return array_map(function (NodeInterface $node): Post {
return new Post();
}, $articles);
}
private function sortByCreatedDate(array &$articles): void {