query = $this->loadService(UserGroupRepositoryQuery::class); } public function getDefaultOptionsSearch(): array { return [ 'with' => [], 'join_with' => [], 'orderby' => '', 'attribute_id_producer' => '' ]; } public function findOneUserGroupById(int $id) { return UserGroup::searchOne(['id' => $id]); } public function findOneUserGroupByName(string $name) { return UserGroup::searchOne(['name' => $name]); } public function findUserGroups() { return UserGroup::find()->where('id_producer = ' . GlobalParam::getCurrentProducerId())->all(); } public function populateUserGroupDropdownList(): array { $userGroupsArrayDropdown = ['' => '--']; $userGroupsArray = $this->findUserGroups(); foreach ($userGroupsArray as $userGroup) { $userGroupsArrayDropdown[$userGroup['id']] = $userGroup['name']; } return $userGroupsArrayDropdown; } }