您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

UserProducerRepository.php 635B

1234567891011121314151617181920212223242526272829
  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. }