|
- <?php
-
- namespace common\repositories;
-
- use common\models\User;
- use common\models\UserProducer;
-
- class UserProducerRepository
- {
- public function getOne($idUser, $idProducer)
- {
- return UserProducer::searchOne([
- 'id_user' => $idUser,
- 'id_producer' => $idProducer
- ]);
- }
-
- public function getBy($idUser, $active = 1, $bookmark = 1)
- {
- return UserProducer::find()
- ->with(['producer'])
- ->where([
- 'id_user' => $idUser,
- 'active' => $active,
- 'bookmark' => $bookmark
- ])
- ->all();
- }
- }
|