private function checkAssociation(UserTrack $userTrack) { $association = $userTrack->getAssociation($this->securityManager->getSocialNetwork()); if ($association == null) { $track = $userTrack->getGlobalTrack(); if ($track == null) { throw ModelException::thereIsNoGlobalObject($userTrack, 'Track'); } $association = $this->associationRepository->findOnePopularByTrack($userTrack->getGlobalTrack()); if ($association != null) { $userTrack->associate($this->securityManager->getSocialNetwork(), $association); } } }