/** * @param UserWithPosition $userWithPosition * * @return bool */ private function hasUserWithPositionTranslations($userWithPosition) { /** @var UserWithPositionTranslation $translation */ foreach ($userWithPosition->getTranslations() as $translation) { if ($translation->getField() == 'position' && $translation->getLocale() == 'en') { return true; } } return false; }
/** * Add user with position * * @param UserWithPosition $userWithPosition User with position * * @return $this */ public function addUsersWithPositions(UserWithPosition $userWithPosition) { $userWithPosition->setProject($this); $this->usersWithPositions->add($userWithPosition); return $this; }