/** * Build roles from id of roles * * @param array $idOfRoles * @return array */ protected function buildRoles($idOfRoles) { $roles = []; foreach ($idOfRoles as $id) { $roles[] = $this->roleRepository->findById($id); } return $roles; }
/** * Retrieve role and ensure role is exist * * @param mixed $id * @return AccountDomainModels\Role */ protected function retrieveRole($id) { $role = $this->roleRepository->findById($id); if (is_null($role)) { throw new ValueNotFoundException("[{$id}] is not valid role id"); } return $role; }