- First commit to issue fork.
Idea for V3 of entity_repository:
Convert the services to plugins and introduce an EntityRepositoryManager class.
$blog_articles_repository = $this->repositoryManager->getRepository('node', 'blog_article');
$blog_articles = blog_articles_repository->findAll();
Plugins would look something like:
<?php
namespace Drupal\my_custom_blog_article_module\src\Plugin\EntityRepository;
use Drupal\entity_repository\BaseNodeRepository;
/**
* @entityRepository(
* entity_type = "node",
* bundle = "blog_article",
* )
*/
class BlogArticleRepository extends BaseNodeRepository {
public function findByCategory(int $id) {
return $this->findBy(['field_blog_category' => $id]);
}
}
When you call the repositoryManager->getRepository('node', 'blog_article') and no plugin is provided, fallback to the default class BaseNodeRepository so ->findAll(), ->findBy still works and you only have to add plugins to add custom queries.
Active
2.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.