/** * * @param \Bpi\ApiBundle\Domain\ValueObject\Yearwheel $yearwheel * @return \Bpi\ApiBundle\Domain\Factory\ProfileBuilder */ public function yearwheel(Yearwheel $yearwheel) { $repo = new YearwheelRepository(); if (!$repo->contains($yearwheel)) { throw new InvalidStateException('Incorrect yearwheel value'); } $this->yearwheel = $yearwheel; return $this; }