/** * @param ObjectManager $manager */ private function loadMarcellaRegondi(ObjectManager $manager) { $registry = new UserRegistry(); $registry->setName('Marcella'); $registry->setSurname('Regondi'); $registry->setUser($this->getReference('user_user2')); $manager->persist($registry); $manager->flush($registry); }
/** * Specify data which should be serialized to JSON * @link http://php.net/manual/en/jsonserializable.jsonserialize.php * @return mixed data which can be serialized by <b>json_encode</b>, * which is a value of any type other than a resource. * @since 5.4.0 */ public function jsonSerialize() { return new JsonApiDocumentElement($this->getId(), User::class, ["username" => $this->getUsernameCanonical(), "email" => $this->getEmailCanonical(), "firstname" => $this->registry->getName(), "lastname" => $this->registry->getSurname()]); }