setUser() public method

Set user
public setUser ( User $user ) : void
$user Newscoop\Entity\User
return void
 public function setUser(\Newscoop\Entity\User $user)
 {
     $this->__load();
     return parent::setUser($user);
 }
 private function apply(Subscription $subscription, SubscriptionData $data)
 {
     if ($data->userId) {
         $user = $this->em->getRepository('Newscoop\\Entity\\User')->getOneActiveUser($data->userId, false)->getOneOrNullResult();
         if ($user) {
             $subscription->setUser($user);
         }
     }
     if ($data->publicationId) {
         $publication = $this->em->getRepository('Newscoop\\Entity\\Publication')->findOneBy(array('id' => $data->publicationId));
         if ($publication) {
             $subscription->setPublication($publication);
         }
     }
     if ($data->toPay) {
         $subscription->setToPay($data->toPay);
     }
     if ($data->currency) {
         $subscription->setCurrency($data->currency);
     }
     if ($data->active) {
         $subscription->setActive($data->active);
     }
     if ($data->type) {
         $subscription->setType($data->type);
     }
     if ($data->sections) {
         $sectionsIds = array();
         foreach ($data->sections as $key => $section) {
             $subscription->addSection($section);
             $sectionsIds[] = $section->getId();
         }
         //Clean conncted sections list
         $subscription->setSections($sectionsIds);
     }
     if ($data->articles) {
         $articlesIds = array();
         foreach ($data->articles as $key => $article) {
             $subscription->addArticle($article);
             $articlesIds[] = $article->getId();
         }
         //Clean conncted sections list
         $subscription->setArticles($articlesIds);
     }
     if ($data->issues) {
         $issuesIds = array();
         foreach ($data->issues as $key => $issue) {
             $subscription->addIssue($issue);
             $issuesIds[] = $issue->getId();
         }
         //Clean conncted sections list
         $subscription->setIssues($issuesIds);
     }
     return $subscription;
 }