|
- <?php
-
- namespace common\logic\PointSale\UserPointSale\Repository;
-
- use common\logic\AbstractRepository;
- use common\logic\PointSale\PointSale\Model\PointSale;
- use common\logic\PointSale\UserPointSale\Model\UserPointSale;
- use common\logic\User\User\Model\User;
-
- class UserPointSaleRepository extends AbstractRepository
- {
- protected UserPointSaleRepositoryQuery $query;
-
- public function loadDependencies(): void
- {
- $this->query = $this->loadService(UserPointSaleRepositoryQuery::class);
- }
-
- public function getDefaultOptionsSearch(): array
- {
- return [
- 'with' => [],
- 'join_with' => [],
- 'orderby' => '',
- 'attribute_id_producer' => ''
- ] ;
- }
-
- public function findUserPointSalesByUser(User $user): array
- {
- return UserPointSale::searchAll([
- 'id_user' => $user->id
- ]);
- }
-
- public function findOneUserPointSale(User $user, PointSale $pointSale)
- {
- return UserPointSale::find()
- ->where([
- 'id_user' => $user->id,
- 'id_point_sale' => $pointSale->id
- ])->one();
- }
- }
|