|
12345678910111213141516171819202122232425262728293031 |
- <?php
-
- namespace common\logic\User\UserProducer;
-
- use common\logic\BaseService;
- use common\logic\Producer\Producer\Producer;
- use common\logic\RepositoryInterface;
- use common\logic\User\User\User;
-
- class UserProducerRepository extends BaseService implements RepositoryInterface
- {
- public function getOne(User $user, Producer $producer)
- {
- return UserProducer::searchOne([
- 'id_user' => $user->id,
- 'id_producer' => $producer->id
- ]);
- }
-
- public function getBy($idUser, $active = 1, $bookmark = 1)
- {
- return UserProducer::find()
- ->with(['producer'])
- ->where([
- 'id_user' => $idUser,
- 'active' => $active,
- 'bookmark' => $bookmark
- ])
- ->all();
- }
- }
|