| @@ 150-168 (lines=19) @@ | ||
| 147 | * |
|
| 148 | * @return null|OrganizationInterface |
|
| 149 | */ |
|
| 150 | public function findByEmployee($userOrId) |
|
| 151 | { |
|
| 152 | $userId = $userOrId instanceof \Auth\Entity\UserInterface ? $userOrId->getId() : $userOrId; |
|
| 153 | ||
| 154 | /* |
|
| 155 | * Employees collection is only set on main organization, |
|
| 156 | * so here, we do not have to query the "parent" field. |
|
| 157 | * |
|
| 158 | * Only search for "assigned" employees. |
|
| 159 | */ |
|
| 160 | $entity = $this->findOneBy( |
|
| 161 | array( |
|
| 162 | 'employees.user' => new \MongoId($userId), |
|
| 163 | 'employees.status' => EmployeeInterface::STATUS_ASSIGNED |
|
| 164 | ) |
|
| 165 | ); |
|
| 166 | ||
| 167 | return $entity; |
|
| 168 | } |
|
| 169 | ||
| 170 | public function findPendingOrganizationsByEmployee($userOrId) |
|
| 171 | { |
|
| @@ 170-182 (lines=13) @@ | ||
| 167 | return $entity; |
|
| 168 | } |
|
| 169 | ||
| 170 | public function findPendingOrganizationsByEmployee($userOrId) |
|
| 171 | { |
|
| 172 | $userId = $userOrId instanceof \Auth\Entity\UserInterface ? $userOrId->getId() : $userOrId; |
|
| 173 | ||
| 174 | $collection = $this->findBy( |
|
| 175 | array( |
|
| 176 | 'employees.user' => new \MongoId($userId), |
|
| 177 | 'employees.status' => EmployeeInterface::STATUS_PENDING |
|
| 178 | ) |
|
| 179 | ); |
|
| 180 | ||
| 181 | return $collection; |
|
| 182 | } |
|
| 183 | ||
| 184 | public function getEmployersCursor(UserInterface $user) |
|
| 185 | { |
|