/**
  * Creates a new pricing.
  *
  * @return \Ekyna\Bundle\SubscriptionBundle\Model\PricingInterface
  */
 public function createNew()
 {
     /** @var \Ekyna\Bundle\SubscriptionBundle\Model\PricingInterface $pricing */
     $pricing = parent::createNew();
     $pricing->setYear(date('Y'))->setPrices($this->priceProvider->createPriceCollection());
     return $pricing;
 }
 /**
  * Generates the subscription by user and year
  *
  * @param UserInterface $user
  * @param string        $year
  * @return \Ekyna\Bundle\SubscriptionBundle\Model\SubscriptionInterface|null
  */
 public function generateByUserAndYear(UserInterface $user, $year)
 {
     $year = Year::validate($year);
     $price = $this->pricingProvider->findPriceByUserAndYear($user, $year);
     if (!$price instanceof PriceInterface) {
         return null;
     }
     /** @var \Ekyna\Bundle\SubscriptionBundle\Model\SubscriptionInterface $subscription */
     $subscription = new $this->subscriptionClass();
     $subscription->setUser($user)->setPrice($price);
     return $this->createSubscription($subscription);
 }