You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
711B

  1. <?php
  2. namespace common\repositories;
  3. use common\models\Producer;
  4. class ProducerRepository
  5. {
  6. public function getOneById($id)
  7. {
  8. return Producer::searchOne(['id' => $id]);
  9. }
  10. public function getOneBySlug($slug)
  11. {
  12. return Producer::searchOne(['slug' => $slug]);
  13. }
  14. public function queryActive()
  15. {
  16. return Producer::find()
  17. ->where([
  18. 'active' => true,
  19. ])
  20. ->orderBy('name ASC');
  21. }
  22. /**
  23. * Retourne le compte producteur de démonstration.
  24. *
  25. * @return Producer
  26. */
  27. public function getDemoAccount()
  28. {
  29. return Producer::find()->where('name LIKE \'Démo\'')->one();
  30. }
  31. }