record) { throw new \LogicException('Fill a record to store a new story'); } if (null === $this->user) { throw new \LogicException('Fill a user to store a new story'); } $story->setRecord($this->record); $story->setUser($this->user); $manager->persist($story); $manager->flush(); $this->story = $story; $this->addReference('one-story', $story); } }