public function create($namespace, $owner, $title, $externalReference = null, Topic $parent = null) { $entity = new Topic(); $entity->setNamespace($namespace); $entity->setTitle($title); $entity->setUserId($owner); $entity->setExternalReference($externalReference); $entity->setParent($parent); return $entity; }
public function load(ObjectManager $manager) { $u1 = new User(); $u1->setUsername('admin'); $u1->setGender(1); $u1->setEmail("*****@*****.**"); $u1->setCreationDate(new \DateTime('now')); $u1->setModificationDate(new \DateTime('now')); $t1 = new Topic(); $t1->setTitle('first topic'); $t1->setAnthorId(1); $t1->setAgree(1); $t1->setDisagree(0); $t1->setContent('long long long string'); $t1->setModificationDate(new \DateTime('now')); $t1->setCreationDate(new \DateTime('now')); $manager->persist($u1); $manager->persist($t1); $manager->flush(); }