public function testSetName() { // new entity $role = new Role(); // Use the setName method $role->setName("Admin"); // Assert the result $this->assertEquals("Admin", $role->getName()); }
/** * Load data fixtures with the passed EntityManager * * @param ObjectManager $manager */ public function load(ObjectManager $manager) { foreach ($this->roles as $role) { $newRole = new Role(); $newRole->setName($role['name']); $manager->persist($newRole); } $manager->flush(); }
/** * {@inheritDoc} */ public function load(ObjectManager $manager) { $userRole = new Role(); $userRole->setName('User'); $userRole->setRole('ROLE_USER'); $userRole->setIsAllowedToSwitch(false); $manager->persist($userRole); $leadRole = new Role(); $leadRole->setName('Lead'); $leadRole->setRole('ROLE_LEAD'); $leadRole->setIsAllowedToSwitch(false); $leadRole->addRoleToHierarchy($userRole); $manager->persist($leadRole); $adminRole = new Role(); $adminRole->setName('Admin'); $adminRole->setRole('ROLE_ADMIN'); $adminRole->setIsAllowedToSwitch(false); $adminRole->addRoleToHierarchy($leadRole); $manager->persist($adminRole); $devRole = new Role(); $devRole->setName('Dev'); $devRole->setRole('ROLE_DEV'); $devRole->setIsAllowedToSwitch(true); $devRole->addRoleToHierarchy($adminRole); $manager->persist($devRole); $manager->flush(); $this->addReference('ROLE_USER', $userRole); $this->addReference('ROLE_LEAD', $leadRole); $this->addReference('ROLE_ADMIN', $adminRole); $this->addReference('ROLE_DEV', $devRole); $aclProvider = $this->container->get('security.acl.provider'); $devRoleSecurityIdentity = new RoleSecurityIdentity('ROLE_DEV'); $adminRoleSecurityIdentity = new RoleSecurityIdentity('ROLE_ADMIN'); $leadRoleSecurityIdentity = new RoleSecurityIdentity('ROLE_LEAD'); $userRoleSecurityIdentity = new RoleSecurityIdentity('ROLE_USER'); $objectIdentity = ObjectIdentity::fromDomainObject($userRole); $acl = $aclProvider->createAcl($objectIdentity); $acl->insertObjectAce($userRoleSecurityIdentity, MaskBuilder::MASK_VIEW); $acl->insertObjectAce($devRoleSecurityIdentity, MaskBuilder::MASK_OPERATOR); $aclProvider->updateAcl($acl); $objectIdentity = ObjectIdentity::fromDomainObject($leadRole); $acl = $aclProvider->createAcl($objectIdentity); $acl->insertObjectAce($userRoleSecurityIdentity, MaskBuilder::MASK_VIEW); $acl->insertObjectAce($devRoleSecurityIdentity, MaskBuilder::MASK_OPERATOR); $aclProvider->updateAcl($acl); $objectIdentity = ObjectIdentity::fromDomainObject($adminRole); $acl = $aclProvider->createAcl($objectIdentity); $acl->insertObjectAce($userRoleSecurityIdentity, MaskBuilder::MASK_VIEW); $acl->insertObjectAce($devRoleSecurityIdentity, MaskBuilder::MASK_OPERATOR); $aclProvider->updateAcl($acl); $objectIdentity = ObjectIdentity::fromDomainObject($devRole); $acl = $aclProvider->createAcl($objectIdentity); $acl->insertObjectAce($devRoleSecurityIdentity, MaskBuilder::MASK_OPERATOR); $aclProvider->updateAcl($acl); }
protected function getRole() { $em = $this->getDoctrine()->getManager(); $role = $em->getRepository("AppBundle:Role")->findOneByName('ROLE_USER'); if (count($role) == 0) { $role = new Role(); $role->setName('ROLE_USER'); $em->persist($role); $em->flush(); } return $role; }
/** * {@inheritDoc} */ public function load(ObjectManager $manager) { $superAdmin = new Role(); $superAdmin->setName('ROLE_SUPER_ADMIN'); $admin = new Role(); $admin->setName('ROLE_ADMIN'); $editor = new Role(); $editor->setName('ROLE_EDITOR'); $manager->persist($superAdmin); $manager->persist($admin); $manager->persist($editor); $manager->flush(); $this->addReference('role-super-admin', $superAdmin); }
protected function _loadRole(ObjectManager $manager) { $array = array(); $array[] = array('role' => 'ROLE_ADMIN', 'name' => 'Admin', 'use' => false); $array[] = array('role' => 'ROLE_STUDENT', 'name' => 'Student', 'use' => true); $array[] = array('role' => 'ROLE_UNCONFIRMED_TEACHER', 'name' => 'Teacher', 'use' => true); $array[] = array('role' => 'ROLE_TEACHER', 'name' => 'Teacher', 'use' => false); foreach ($array as $roles) { $role = new Role(); $role->setName($roles['name']); $role->setRole($roles['role']); $role->setUserole($roles['use']); $manager->persist($role); } $manager->flush(); }
public function load(ObjectManager $manager) { $role = new Role(); $role->setName('ROLE_ADMIN'); $manager->persist($role); /*** * * Newsletter roles * */ $roles_string_list = array('ROLE_MANAGE_NEWSLETTER', 'ROLE_NEWSLETTER_ADD_CONTENT', 'ROLE_NEWSLETTER_EDIT_CONTENT', 'ROLE_NEWSLETTER_ADD_USER', 'ROLE_NEWSLETTER_EDIT_USER', 'ROLE_NEWSLETTER_SEARCH_USER', 'ROLE_NEWSLETTER_DOWNLOAD_USERS', 'ROLE_NEWSLETTER_UPLOAD_USERS', 'ROLE_NEWSLETTER_ADD_GROUP', 'ROLE_NEWSLETTER_EDIT_GROUP', 'ROLE_NEWSLETTER_REMOVE_GROUP', 'ROLE_NEWSLETTER_CREATE_EMAIL_LAYOUT', 'ROLE_NEWSLETTER_EDIT_EMAIL_LAYOUT'); $roles_list = array(); foreach ($roles_string_list as $name) { $r1 = new Role(); $r1->setName($name); $manager->persist($r1); $roles_list[] = $r1; } $userManager = $this->container->get('fos_user.user_manager'); $user = $userManager->createUser(); $user->setUsername('*****@*****.**'); $user->setEmail('*****@*****.**'); $user->setPlainPassword('1234'); $user->setEnabled(true); $user->setSuperAdmin(true); $user->setNombre('Rodrigo Santellan'); $user->addRole($role); foreach ($roles_list as $rl) { $user->addRole($rl); } $manager->persist($user); $admin = $userManager->createUser(); $admin->setUsername('bunnysadministrador'); $admin->setEmail('*****@*****.**'); $admin->setPlainPassword('bunnyskinder1974'); $admin->setEnabled(true); $admin->setSuperAdmin(true); $admin->addRole($role); foreach ($roles_list as $rl) { $admin->addRole($rl); } $manager->persist($admin); $manager->flush(); }
/** * @Route("/verifyLogin") * @Route("/verifyLogin/") */ public function verifyLoginAction($getUsername, $getPassword) { $account = new account(); $em = $this->getDoctrine()->getManager(); $query = $em->createQueryBuilder()->select('COUNT(f.id)')->from('AppBundle:Account', 'f')->where('f.username = :username', 'f.password = :password')->setParameter('username', $getUsername)->setParameter('password', strtoupper(sha1($getUsername . ":" . $getPassword)))->getQuery(); $total = $query->getSingleScalarResult(); if ($total >= 1) { //logged in $role = new Role(); $role->setName(strtoupper($getUsername)); $role->setRole('ROLE_USER'); return $this->redirect('/account'); } else { //wrong password/username //die("wrong username/password"); return $this->redirect('/login/wrong-credentials'); } return $this->render('twitter/success_created.html.twig', array('getUsername' => $getUsername, 'getEmail' => $getEmail, 'current_year' => date("Y"))); }
public function load(ObjectManager $manager) { $role1 = new Role(); $role1->setName('Admin'); $role1->setRole('ROLE_ADMIN'); $manager->persist($role1); $role2 = new Role(); $role2->setName('Superadmin'); $role2->setRole('ROLE_SUPER_ADMIN'); $manager->persist($role2); $role3 = new Role(); $role3->setName('User'); $role3->setRole('ROLE_USER'); $manager->persist($role3); $role4 = new Role(); $role4->setName('Highest admin'); $role4->setRole('ROLE_HIGHEST_ADMIN'); $manager->persist($role4); $manager->flush(); $this->addReference('role-1', $role1); $this->addReference('role-2', $role2); $this->addReference('role-3', $role3); $this->addReference('role-4', $role4); }
/** * {@inheritDoc} */ public function load(ObjectManager $manager) { $role = new Role(); $role->setName('Top Lane'); $role->setSystName('lol_top'); $role->setGame($this->getReference('lol-game')); $manager->persist($role); $role1 = new Role(); $role1->setName('Middle Lane'); $role1->setSystName('lol_mid'); $role1->setGame($this->getReference('lol-game')); $manager->persist($role1); $role2 = new Role(); $role2->setName('Bottom Carry'); $role2->setSystName('lol_bot'); $role2->setGame($this->getReference('lol-game')); $manager->persist($role2); $role3 = new Role(); $role3->setName('Support'); $role3->setSystName('lol_sup'); $role3->setGame($this->getReference('lol-game')); $manager->persist($role3); $role4 = new Role(); $role4->setName('Jungle'); $role4->setSystName('lol_jun'); $role4->setGame($this->getReference('lol-game')); $manager->persist($role4); $role5 = new Role(); $role5->setName('Entry Fragger'); $role5->setSystName('csg_ent'); $role5->setGame($this->getReference('csgo-game')); $manager->persist($role5); $role6 = new Role(); $role6->setName('Playmaker'); $role6->setSystName('csg_pla'); $role6->setGame($this->getReference('csgo-game')); $manager->persist($role6); $role7 = new Role(); $role7->setName('Strat Caller'); $role7->setSystName('csg_str'); $role7->setGame($this->getReference('csgo-game')); $manager->persist($role7); $role8 = new Role(); $role8->setName('Support'); $role8->setSystName('csg_sup'); $role8->setGame($this->getReference('csgo-game')); $manager->persist($role8); $role10 = new Role(); $role10->setName('Awper'); $role10->setSystName('csg_awp'); $role10->setGame($this->getReference('csgo-game')); $manager->persist($role10); $role11 = new Role(); $role11->setName('Lurker'); $role11->setSystName('csg_lur'); $role11->setGame($this->getReference('csgo-game')); $manager->persist($role11); $manager->flush(); $this->addReference('role', $role); $this->addReference('role1', $role1); $this->addReference('role2', $role2); $this->addReference('role3', $role3); $this->addReference('role4', $role4); $this->addReference('role5', $role5); $this->addReference('role6', $role6); $this->addReference('role7', $role7); $this->addReference('role8', $role8); $this->addReference('role10', $role10); $this->addReference('role11', $role11); }
public function testAddRole() { // new entity $user = new User(); // New dummy entity $role1 = new Role(); $role1->setName("role1"); // Use the addRole method $user->addRole($role1); // Roles is stored in an array $roles = $user->getRoles(); // Loop through the array and check for matches foreach ($roles as $role) { if ($role1 == $role) { // Assert the result $this->assertEquals($role1, $role); } } }
public function load(ObjectManager $manager) { $doctrine = $this->container->get('doctrine'); $entities = $this->container->get('app.entities'); /** * Справочник для статусов записи */ $scroll = new Scroll(); $scroll->setCode('entry_status'); $scroll->setTitle('Entry status'); $scroll->setPosition('1'); $manager->persist($scroll); $manager->flush(); /** * Cтатусы записи */ // enabled $scrollItemEnable = new ScrollItem(); $scrollItemEnable->setScroll($scroll); $scrollItemEnable->setCode('enable'); $scrollItemEnable->setTitle('Enabled'); $scrollItemEnable->setPosition(1); $manager->persist($scrollItemEnable); // disable $scrollItemDisable = new ScrollItem(); $scrollItemDisable->setScroll($scroll); $scrollItemDisable->setCode('disable'); $scrollItemDisable->setTitle('Disabled'); $scrollItemDisable->setPosition(2); $manager->persist($scrollItemDisable); // delete $scrollItemDeleted = new ScrollItem(); $scrollItemDeleted->setScroll($scroll); $scrollItemDeleted->setCode('delete'); $scrollItemDeleted->setTitle('Deleted'); $scrollItemDeleted->setPosition(3); $manager->persist($scrollItemDeleted); $manager->flush(); /** * Справочник для Вариантов типа данных аттрибута */ $scrollAttributeDataTypes = new Scroll(); $scrollAttributeDataTypes->setCode('data_types'); $scrollAttributeDataTypes->setTitle('Варианты данных'); $scrollAttributeDataTypes->setPosition('2'); $manager->persist($scrollAttributeDataTypes); $manager->flush(); /** * Типы записи */ // string $scrollItemDataString = new ScrollItem(); $scrollItemDataString->setScroll($scrollAttributeDataTypes); $scrollItemDataString->setCode('string'); $scrollItemDataString->setTitle('Строка'); $scrollItemDataString->setPosition(1); $manager->persist($scrollItemDataString); // numeric $scrollItemDataNumeric = new ScrollItem(); $scrollItemDataNumeric->setScroll($scrollAttributeDataTypes); $scrollItemDataNumeric->setCode('numeric'); $scrollItemDataNumeric->setTitle('Число'); $scrollItemDataNumeric->setPosition(2); $manager->persist($scrollItemDataNumeric); // date $scrollItemDataDate = new ScrollItem(); $scrollItemDataDate->setScroll($scrollAttributeDataTypes); $scrollItemDataDate->setCode('date'); $scrollItemDataDate->setTitle('Дата'); $scrollItemDataDate->setPosition(3); $manager->persist($scrollItemDataDate); $manager->flush(); /** * Справочник для Вариантов отображения аттрибута */ $scrollAttributeViewTypes = new Scroll(); $scrollAttributeViewTypes->setCode('view_types'); $scrollAttributeViewTypes->setTitle('Варианты отображения'); $scrollAttributeViewTypes->setPosition('1'); $manager->persist($scrollAttributeViewTypes); $manager->flush(); /** * Cтатусы записи */ // string $scrollItemString = new ScrollItem(); $scrollItemString->setScroll($scrollAttributeViewTypes); $scrollItemString->setCode('string'); $scrollItemString->setTitle('Строка'); $scrollItemString->setPosition(1); $manager->persist($scrollItemString); // checkbox $scrollItemCheckbox = new ScrollItem(); $scrollItemCheckbox->setScroll($scrollAttributeViewTypes); $scrollItemCheckbox->setCode('select'); $scrollItemCheckbox->setTitle('Выбор'); $scrollItemCheckbox->setPosition(2); $manager->persist($scrollItemCheckbox); // select $scrollItemSelectd = new ScrollItem(); $scrollItemSelectd->setScroll($scrollAttributeViewTypes); $scrollItemSelectd->setCode('checkbox'); $scrollItemSelectd->setTitle('Множественный выбор'); $scrollItemSelectd->setPosition(3); $manager->persist($scrollItemSelectd); $manager->flush(); /** * Справочник типов экшенов */ $scrollActionTypes = new Scroll(); $scrollActionTypes->setCode('action_types'); $scrollActionTypes->setTitle('Варианты экшенов'); $scrollActionTypes->setPosition('4'); $manager->persist($scrollActionTypes); $manager->flush(); /** * Типы экшенов */ // string $scrollItemActionIndex = new ScrollItem(); $scrollItemActionIndex->setScroll($scrollActionTypes); $scrollItemActionIndex->setCode('index'); $scrollItemActionIndex->setTitle('Индексная страница'); $scrollItemActionIndex->setPosition(1); $manager->persist($scrollItemActionIndex); // checkbox $scrollItemActionShow = new ScrollItem(); $scrollItemActionShow->setScroll($scrollActionTypes); $scrollItemActionShow->setCode('show'); $scrollItemActionShow->setTitle('Обзор'); $scrollItemActionShow->setPosition(2); $manager->persist($scrollItemActionShow); $manager->flush(); /** * Справочник для Вариантов типа данных аттрибута */ $scrollProductTypes = new Scroll(); $scrollProductTypes->setCode('shop_product_types'); $scrollProductTypes->setTitle('Группы товаров'); $scrollProductTypes->setPosition('100'); $manager->persist($scrollProductTypes); $manager->flush(); /** * Типы записи */ // clothes $scrollItemClothes = new ScrollItem(); $scrollItemClothes->setScroll($scrollProductTypes); $scrollItemClothes->setCode('clothes'); $scrollItemClothes->setTitle('Одежда'); $scrollItemClothes->setPosition(1); $manager->persist($scrollItemClothes); // toys $scrollItemToys = new ScrollItem(); $scrollItemToys->setScroll($scrollProductTypes); $scrollItemToys->setCode('toys'); $scrollItemToys->setTitle('Игрушки'); $scrollItemToys->setPosition(2); $manager->persist($scrollItemToys); $manager->flush(); /** * Роли пользователя */ // super admin $roleSuperAdmin = new Role(); $roleSuperAdmin->setName('ROLE_SUPER_ADMIN'); $manager->persist($roleSuperAdmin); // admin $roleAdmin = new Role(); $roleAdmin->setName('ROLE_ADMIN'); $manager->persist($roleAdmin); // manager $roleManager = new Role(); $roleManager->setName('ROLE_MANAGER'); $manager->persist($roleManager); // moderator $roleModerator = new Role(); $roleModerator->setName('ROLE_MODERATOR'); $manager->persist($roleModerator); // client $roleClient = new Role(); $roleClient->setName('ROLE_CLIENT'); $manager->persist($roleClient); // manager $roleUser = new Role(); $roleUser->setName('ROLE_USER'); $manager->persist($roleUser); $manager->flush(); /** * Пользователь */ $encoder = $this->container->get('security.password_encoder'); // wy $userWY = new User(); $userWY->setPassword($encoder->encodePassword($userWY, 'q1w2e3')); $userWY->setUsername('wy'); $userWY->setEntryStatus($scrollItemEnable); $userWY->setEmail('*****@*****.**'); $userWY->setRealName('Web-You.Ru'); $userWY->addUserRole($roleAdmin); $manager->persist($userWY); $manager->flush(); /** * Модуль */ // News $moduleNews = new Module(); $moduleNews->setEntityCode('news'); $moduleNews->setEntryStatus($scrollItemEnable); $moduleNews->setRoutePath('/news'); $moduleNews->setTitle('Новости'); $manager->persist($moduleNews); // Page $modulePage = new Module(); $modulePage->setEntityCode('page'); $modulePage->setEntryStatus($scrollItemEnable); $modulePage->setRoutePath('/pages'); $modulePage->setTitle('Страницы'); $manager->persist($modulePage); // Brend $moduleBrend = new Module(); $moduleBrend->setEntityCode('brend'); $moduleBrend->setEntryStatus($scrollItemEnable); $moduleBrend->setRoutePath('/brends'); $moduleBrend->setTitle('Бренды'); $manager->persist($moduleBrend); // Index $moduleIndex = new Module(); $moduleIndex->setEntityCode('index'); $moduleIndex->setEntryStatus($scrollItemEnable); $moduleIndex->setRoutePath('/'); $moduleIndex->setTitle('Главная страница'); $manager->persist($moduleIndex); // Catalog $moduleCatalog = new Module(); $moduleCatalog->setEntityCode('catalog'); $moduleCatalog->setEntryStatus($scrollItemEnable); $moduleCatalog->setRoutePath('/catalog'); $moduleCatalog->setTitle('Каталог'); $manager->persist($moduleCatalog); // User $moduleUser = new Module(); $moduleUser->setEntityCode('user'); $moduleUser->setEntryStatus($scrollItemEnable); $moduleUser->setRoutePath('/user'); $moduleUser->setTitle('Пользователи'); $manager->persist($moduleUser); $manager->flush(); /** * Страницы модуля PAGE */ // Page - index $modulePageIndex = new ModulePage(); $modulePageIndex->setEntryStatus($scrollItemEnable); $modulePageIndex->setModule($modulePage); $modulePageIndex->setTitle('Список страниц'); $modulePageIndex->setMetaDescription('All our page'); $modulePageIndex->setMetaKeywords('page, all page'); $modulePageIndex->setRoutePath('/page'); $modulePageIndex->setAction('index'); $manager->persist($modulePageIndex); // Page - route $modulePageRoute = new ModulePage(); $modulePageRoute->setEntryStatus($scrollItemEnable); $modulePageRoute->setModule($modulePage); $modulePageRoute->setTitle('Обзор страницы'); $modulePageRoute->setMetaDescription('Page viewing'); $modulePageRoute->setMetaKeywords('page, viewing'); $modulePageRoute->setRoutePath('/page/{slug}'); $modulePageRoute->setAction('route'); $manager->persist($modulePageRoute); $manager->flush(); /** * Страницы модуля NEWS */ // News - index $moduleNewsIndex = new ModulePage(); $moduleNewsIndex->setEntryStatus($scrollItemEnable); $moduleNewsIndex->setModule($moduleNews); $moduleNewsIndex->setTitle('Список новостей'); $moduleNewsIndex->setMetaDescription('All our news'); $moduleNewsIndex->setMetaKeywords('news, all news'); $moduleNewsIndex->setRoutePath('/news'); $moduleNewsIndex->setAction('route'); $manager->persist($moduleNewsIndex); // News - route $moduleNewsRoute = new ModulePage(); $moduleNewsRoute->setEntryStatus($scrollItemEnable); $moduleNewsRoute->setModule($moduleNews); $moduleNewsRoute->setTitle('Обзор новости'); $moduleNewsRoute->setMetaDescription('News viewing'); $moduleNewsRoute->setMetaKeywords('news, viewing'); $moduleNewsRoute->setRoutePath('/news/{slug}'); $moduleNewsRoute->setAction('route'); $manager->persist($moduleNewsRoute); $manager->flush(); /** * Страницы модуля Index */ // Index - index $moduleIndexIndex = new ModulePage(); $moduleIndexIndex->setEntryStatus($scrollItemEnable); $moduleIndexIndex->setModule($moduleIndex); $moduleIndexIndex->setTitle('Индекс'); $moduleIndexIndex->setMetaDescription('Index page'); $moduleIndexIndex->setMetaKeywords('Index page'); $moduleIndexIndex->setRoutePath('/'); $moduleIndexIndex->setAction('route'); $manager->persist($moduleIndexIndex); $manager->flush(); /** * Страницы модуля Catalog */ // catalog - index $moduleCatalogIndex = new ModulePage(); $moduleCatalogIndex->setEntryStatus($scrollItemEnable); $moduleCatalogIndex->setModule($moduleCatalog); $moduleCatalogIndex->setTitle('Каталог'); $moduleCatalogIndex->setMetaDescription('Каталог товаров'); $moduleCatalogIndex->setMetaKeywords('Каталог, товары'); $moduleCatalogIndex->setRoutePath('/catalog'); $moduleCatalogIndex->setAction('route'); $manager->persist($moduleCatalogIndex); // catalog - route $moduleCatalogRoute = new ModulePage(); $moduleCatalogRoute->setEntryStatus($scrollItemEnable); $moduleCatalogRoute->setModule($moduleCatalog); $moduleCatalogRoute->setTitle('Обзор категории'); $moduleCatalogRoute->setMetaDescription('Обзор категории'); $moduleCatalogRoute->setMetaKeywords('Обзор, категории'); $moduleCatalogRoute->setRoutePath('/catalog/category/{slug}'); $moduleCatalogRoute->setAction('route'); $manager->persist($moduleCatalogRoute); $manager->flush(); /** * Страницы модуля Brend */ // brends - index $moduleBrendsIndex = new ModulePage(); $moduleBrendsIndex->setEntryStatus($scrollItemEnable); $moduleBrendsIndex->setModule($moduleBrend); $moduleBrendsIndex->setTitle('Бренды'); $moduleBrendsIndex->setMetaDescription('Список брендов'); $moduleBrendsIndex->setMetaKeywords('бренды'); $moduleBrendsIndex->setRoutePath('/brends'); $moduleBrendsIndex->setAction('route'); $manager->persist($moduleBrendsIndex); // brends - route $moduleBrendsRoute = new ModulePage(); $moduleBrendsRoute->setEntryStatus($scrollItemEnable); $moduleBrendsRoute->setModule($moduleBrend); $moduleBrendsRoute->setTitle('Обзор бренда'); $moduleBrendsRoute->setMetaDescription('Обзор бренда'); $moduleBrendsRoute->setMetaKeywords('Обзор, бренд'); $moduleBrendsRoute->setRoutePath('/brend/{slug}'); $moduleBrendsRoute->setAction('route'); $manager->persist($moduleBrendsRoute); $manager->flush(); /** * Страницы модуля User */ // user - auth $moduleBrendsLogin = new ModulePage(); $moduleBrendsLogin->setEntryStatus($scrollItemEnable); $moduleBrendsLogin->setModule($moduleUser); $moduleBrendsLogin->setTitle('Авторизация'); $moduleBrendsLogin->setMetaDescription('Авторизация на сайте'); $moduleBrendsLogin->setMetaKeywords('Авторизация на сайте'); $moduleBrendsLogin->setRoutePath('/login'); $moduleBrendsLogin->setAction('login'); $manager->persist($moduleBrendsLogin); $manager->flush(); /** * Навигация */ // Top menu $topNavigation = new Navigation(); $topNavigation->setEntryStatus($scrollItemEnable); $topNavigation->setTitle('Top menu'); $topNavigation->setCode('top_menu'); $manager->persist($topNavigation); // Top menu items $topNavigationItemNews = new NavigationItem(); $topNavigationItemNews->setEntryStatus($scrollItemEnable); $topNavigationItemNews->setModule($moduleNews); $topNavigationItemNews->setNavigation($topNavigation); $topNavigationItemNews->setRoute($moduleNewsIndex->getRoute()); $topNavigationItemNews->setPosition(1); $topNavigationItemNews->setTitle('News'); $topNavigationItemNews->setModulePage($moduleNewsIndex); //$manager->persist($topNavigationItemNews); $manager->flush(); /** * Аттрибуты товаров */ $entityScroll = $entities->scroll_item; $status = $doctrine->getRepository($entityScroll->getLogicalName())->findByScrollItemCodeAndScrollCode('enable', 'entry_status'); $dataTypes = $doctrine->getRepository($entityScroll->getLogicalName())->findByScrollItemCodeAndScrollCode('numeric', 'data_types'); $viewTypes = $doctrine->getRepository($entityScroll->getLogicalName())->findByScrollItemCodeAndScrollCode('select', 'view_types'); $productTypes = $doctrine->getRepository($entityScroll->getLogicalName())->findByScrollItemCodeAndScrollCode('clothes', 'shop_product_types'); $attributeSize = new Attribute(); $attributeSize->setTitle('Размер'); $attributeSize->setDescription('Размеры одежды'); $attributeSize->setInFilters(true); $attributeSize->setInPreview(true); $attributeSize->setEntryStatus($status); $attributeSize->setDataType($dataTypes); $attributeSize->setViewType($viewTypes); $attributeSize->setProductType($productTypes); $manager->persist($attributeSize); $manager->flush(); //авторизуемся $this->container->get('security.token_storage')->setToken(new UsernamePasswordToken($userWY, null, 'secured_area', $userWY->getRoles())); //IMPORT $this->loadNewsCSV($manager, $scrollItemEnable); $this->loadBrendsCSV($manager, $scrollItemEnable); }