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.

32 lines
848B

  1. <?php
  2. namespace common\logic\User\UserGroup;
  3. use common\helpers\GlobalParam;
  4. use common\logic\BaseService;
  5. use common\logic\RepositoryInterface;
  6. class UserGroupRepository extends BaseService implements RepositoryInterface
  7. {
  8. public function defaultOptionsSearch()
  9. {
  10. return [
  11. 'with' => [],
  12. 'join_with' => [],
  13. 'orderby' => '',
  14. 'attribute_id_producer' => ''
  15. ];
  16. }
  17. public function populateDropdownList(): array
  18. {
  19. $userGroupsArrayDropdown = ['' => '--'];
  20. $userGroupsArray = UserGroup::find()->where('id_producer = ' . GlobalParam::getCurrentProducerId())->all();
  21. foreach ($userGroupsArray as $userGroup) {
  22. $userGroupsArrayDropdown[$userGroup['id']] = $userGroup['name'];
  23. }
  24. return $userGroupsArrayDropdown;
  25. }
  26. }