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.

29 line
635B

  1. <?php
  2. namespace common\repositories;
  3. use common\models\User;
  4. use common\models\UserProducer;
  5. class UserProducerRepository
  6. {
  7. public function getOne($idUser, $idProducer)
  8. {
  9. return UserProducer::searchOne([
  10. 'id_user' => $idUser,
  11. 'id_producer' => $idProducer
  12. ]);
  13. }
  14. public function getBy($idUser, $active = 1, $bookmark = 1)
  15. {
  16. return UserProducer::find()
  17. ->with(['producer'])
  18. ->where([
  19. 'id_user' => $idUser,
  20. 'active' => $active,
  21. 'bookmark' => $bookmark
  22. ])
  23. ->all();
  24. }
  25. }