/**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @see Console\Command\Command
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $manager = $this->getManager();
     $operator = new Group('Operator', ['ROLE_USER']);
     $doctor = new Group('Doctor', ['ROLE_USER']);
     $admin = new Group('Admin', ['ROLE_USER', 'ROLE_ADMIN']);
     $manager->persist($operator);
     $manager->persist($doctor);
     $manager->persist($admin);
     foreach ($this->doctorNames as $key => $name) {
         $dctr = new User();
         $dctr->setName($name);
         $dctr->setUsername($key);
         $dctr->setUsernameCanonical($key);
         $dctr->setEmail($key . '@ortofit.com.ua');
         $dctr->setUsernameCanonical($key . '@ortofit.com.ua');
         $dctr->setEnabled(true);
         $dctr->setSalt('skur7u3vt3400swsowowk88w80888k0');
         $dctr->setPassword('$2y$13$skur7u3vt3400swsowowkuFuZFwo2Igjz5jKzE8b0jPDu/NjeJi4O');
         $dctr->addGroup($doctor);
         $manager->persist($dctr);
     }
     $opr = new User();
     $opr->setUsername('operator');
     $opr->setName('operator');
     $opr->setUsernameCanonical('operator');
     $opr->setEmail('*****@*****.**');
     $opr->setUsernameCanonical('*****@*****.**');
     $opr->setEnabled(true);
     $opr->setSalt('skur7u3vt3400swsowowk88w80888k0');
     $opr->setPassword('$2y$13$skur7u3vt3400swsowowkuFuZFwo2Igjz5jKzE8b0jPDu/NjeJi4O');
     $opr->addGroup($operator);
     $manager->persist($opr);
     /** @var Appointment[] $apps */
     $apps = $manager->getRepository(Appointment::clazz())->findAll();
     foreach ($apps as $app) {
         $app->setUser($dctr);
         $manager->merge($app);
     }
     /** @var Service $services */
     $services = $manager->getRepository(Service::clazz())->find(1);
     $services->setName('Консультации');
     $services->setColor('#cdaa40');
     $services->setShort('(Конс.)');
     $manager->merge($services);
     $services = $manager->getRepository(Service::clazz())->find(2);
     $services->setName("Коррекция стелек");
     $services->setColor('#2e8b57');
     $services->setShort('(КС)');
     $manager->merge($services);
     $services = $manager->getRepository(Service::clazz())->find(3);
     $services->setName("Изготовление стелек ");
     $services->setColor('#818100');
     $services->setShort('(ИОС)');
     $manager->merge($services);
     //Массаж
     $services = $manager->getRepository(Service::clazz())->find(4);
     $services->setColor('#ff69b4');
     $services->setShort('(М)');
     $manager->merge($services);
     $services = new Service();
     $services->setName('Компьютерная диагностика');
     $services->setColor('#ffa500');
     $services->setShort('(КД)');
     $manager->persist($services);
     $services = new Service();
     $services->setName('Бесплатная консультация');
     $services->setColor('#4876ff');
     $services->setShort('(б/п конс)');
     $manager->persist($services);
     $manager->flush();
 }
 /**
  * Load data fixtures with the passed EntityManager
  *
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $admin = new User();
     $admin->setUsername('admin');
     $admin->setName('admin');
     $admin->setUsernameCanonical('admin');
     $admin->setEmail('*****@*****.**');
     $admin->setUsernameCanonical('*****@*****.**');
     $admin->setEnabled(true);
     $admin->setSalt('nstzpcv8dmsk8oocso8c48s0c0wkkgs');
     $admin->setPassword('$2y$13$nstzpcv8dmsk8oocso8c4u09IhighblmsbePPBLb5NZKASdkqjYiK');
     $admin->addGroup($this->getReference('group:admin'));
     $manager->persist($admin);
     foreach ($this->doctorNames as $key => $name) {
         $doctor = new User();
         $doctor->setName($name);
         $doctor->setUsername('doctor' . $name);
         $doctor->setUsernameCanonical('doctor' . $name);
         $doctor->setEmail('doctor' . $name . '@ortofit.com.ua');
         $doctor->setUsernameCanonical('doctor' . $name . '@ortofit.com.ua');
         $doctor->setEnabled(true);
         $doctor->setSalt('nstzpcv8dmsk8oocso8c48s0c0wkkgs');
         $doctor->setPassword('$2y$13$nstzpcv8dmsk8oocso8c4u09IhighblmsbePPBLb5NZKASdkqjYiK');
         $doctor->addGroup($this->getReference('group:doctor'));
         $this->addReference('doctor:' . $key, $doctor);
         $manager->persist($doctor);
     }
     $operator = new User();
     $operator->setUsername('operator');
     $operator->setName('operator');
     $operator->setUsernameCanonical('operator');
     $operator->setEmail('*****@*****.**');
     $operator->setUsernameCanonical('*****@*****.**');
     $operator->setEnabled(true);
     $operator->setSalt('nstzpcv8dmsk8oocso8c48s0c0wkkgs');
     $operator->setPassword('$2y$13$nstzpcv8dmsk8oocso8c4u09IhighblmsbePPBLb5NZKASdkqjYiK');
     $operator->addGroup($this->getReference('group:operator'));
     $manager->persist($operator);
     $manager->flush();
 }
 /**
  * @Rest\View
  */
 public function usersAction()
 {
     $users = $this->getDoctrine()->getManager()->getRepository(User::clazz())->findAll();
     return array('users' => $users);
 }