/** * Set new extension to user * @param string $nameId nameId of the user * @return Extension the extension */ private function createExtension($nameId) { $nextExtension = $this->getNextExtension(); $entity = new Extension(); $entity->setNameId($nameId); $entity->setLastLogin(new \DateTime()); $entity->setExtension($nextExtension); $em = $this->getDoctrine()->getManager(); $em->persist($entity); $em->flush(); return $entity; }
/** * @Given there are extensions: */ public function thereAreExtensions(TableNode $table) { foreach ($table->getHash() as $hash) { $extension = new Extension(); $extension->setNameId($hash['nameId']); $extension->setExtension($hash['extension']); $extension->setLastLogin(new \DateTime($hash['lastLogin'])); $em = $this->getContainer()->get('doctrine.orm.entity_manager'); $em->persist($extension); } $em->flush(); }