Exemplo n.º 1
0
 /**
  * @return Organization
  */
 public static function createOrga()
 {
     $orga = new Organization();
     $orga->setName('Orga ORGA');
     $orga->setLogin('orga');
     $orga->setContactMail('*****@*****.**');
     $orga->testingContext = true;
     $reflection = new \ReflectionObject($orga);
     $property = $reflection->getProperty('id');
     $property->setAccessible(true);
     $property->setValue($orga, 1);
     return $orga;
 }
Exemplo n.º 2
0
    /**
     * @param \Symfony\Component\Console\Input\InputInterface $input
     * @param \Symfony\Component\Console\Output\OutputInterface $output
     * @return void
     * @throws \RuntimeException
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $dialog = $this->getHelperSet()->get('dialog');
        $output->writeln('
	Welcome to the EtuUTT organizations manager

This command helps you to create an organization using the command.
');
        /** @var EntityManager $em */
        $em = $this->getContainer()->get('doctrine')->getManager();
        $orga = new Organization();
        $orga->setName($dialog->ask($output, 'Name: '));
        $orga->setLogin($dialog->ask($output, 'Identifier: '));
        $em->persist($orga);
        $em->flush();
        $output->writeln("\nDone.\n");
    }
Exemplo n.º 3
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $admin = new User();
     $admin->setFullName('Admin ADMIN');
     $admin->setLogin('admin');
     $admin->setMail('*****@*****.**');
     $admin->setIsAdmin(true);
     $admin->setAvatar('admin.png');
     $admin->setBirthday(new \DateTime());
     $admin->setLastVisitHome(new \DateTime());
     $admin->setReadOnlyExpirationDate(new \DateTime());
     $user = new User();
     $user->setFullName('User USER');
     $user->setLogin('user');
     $user->setMail('*****@*****.**');
     $user->setIsAdmin(false);
     $user->setAvatar('user.png');
     $user->setBirthday(new \DateTime());
     $user->setLastVisitHome(new \DateTime());
     $user->setReadOnlyExpirationDate(new \DateTime());
     $orga = new Organization();
     $orga->setName('Orga ORGA');
     $orga->setLogin('orga');
     $orga->setContactMail('*****@*****.**');
     $manager->persist($admin);
     $manager->persist($user);
     $manager->persist($orga);
     $membership = new Member();
     $membership->setOrganization($orga);
     $membership->setUser($user);
     $membership->addPermission('daymail');
     $manager->persist($membership);
     $manager->flush();
     $this->addReference('user_admin', $admin);
     $this->addReference('user_user', $user);
     $this->addReference('user_orga', $orga);
     $this->addReference('user_membership', $orga);
 }