@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | */ |
33 | 33 | protected function configure() |
34 | 34 | { |
35 | - $this->setName( self::$defaultName ); |
|
36 | - $this->setDescription( 'Initialize or update the Aimeos database tables' ); |
|
37 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' ); |
|
38 | - $this->addArgument( 'tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default' ); |
|
39 | - $this->addOption( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() ); |
|
40 | - $this->addOption( 'action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate' ); |
|
41 | - $this->addOption( 'task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null ); |
|
35 | + $this->setName(self::$defaultName); |
|
36 | + $this->setDescription('Initialize or update the Aimeos database tables'); |
|
37 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default'); |
|
38 | + $this->addArgument('tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default'); |
|
39 | + $this->addOption('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array()); |
|
40 | + $this->addOption('action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate'); |
|
41 | + $this->addOption('task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -48,41 +48,41 @@ discard block |
||
48 | 48 | * @param InputInterface $input Input object |
49 | 49 | * @param OutputInterface $output Output object |
50 | 50 | */ |
51 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
51 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
52 | 52 | { |
53 | - $ctx = $this->getContainer()->get( 'aimeos_context' )->get( false, 'command' ); |
|
54 | - $ctx->setEditor( 'aimeos:setup' ); |
|
53 | + $ctx = $this->getContainer()->get('aimeos_context')->get(false, 'command'); |
|
54 | + $ctx->setEditor('aimeos:setup'); |
|
55 | 55 | |
56 | 56 | $config = $ctx->getConfig(); |
57 | - $site = $input->getArgument( 'site' ); |
|
58 | - $tplsite = $input->getArgument( 'tplsite' ); |
|
57 | + $site = $input->getArgument('site'); |
|
58 | + $tplsite = $input->getArgument('tplsite'); |
|
59 | 59 | |
60 | - $config->set( 'setup/site', $site ); |
|
61 | - $dbconfig = $this->getDbConfig( $config ); |
|
62 | - $this->setOptions( $config, $input ); |
|
60 | + $config->set('setup/site', $site); |
|
61 | + $dbconfig = $this->getDbConfig($config); |
|
62 | + $this->setOptions($config, $input); |
|
63 | 63 | |
64 | - $taskPaths = $this->getContainer()->get( 'aimeos' )->get()->getSetupPaths( $tplsite ); |
|
65 | - $manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx ); |
|
64 | + $taskPaths = $this->getContainer()->get('aimeos')->get()->getSetupPaths($tplsite); |
|
65 | + $manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx); |
|
66 | 66 | |
67 | - $output->writeln( sprintf( 'Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site ) ); |
|
67 | + $output->writeln(sprintf('Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site)); |
|
68 | 68 | |
69 | - if( ( $task = $input->getOption( 'task' ) ) && is_array( $task ) ) { |
|
70 | - $task = reset( $task ); |
|
69 | + if (($task = $input->getOption('task')) && is_array($task)) { |
|
70 | + $task = reset($task); |
|
71 | 71 | } |
72 | 72 | |
73 | - switch( $input->getOption( 'action' ) ) |
|
73 | + switch ($input->getOption('action')) |
|
74 | 74 | { |
75 | 75 | case 'migrate': |
76 | - $manager->migrate( $task ); |
|
76 | + $manager->migrate($task); |
|
77 | 77 | break; |
78 | 78 | case 'rollback': |
79 | - $manager->rollback( $task ); |
|
79 | + $manager->rollback($task); |
|
80 | 80 | break; |
81 | 81 | case 'clean': |
82 | - $manager->clean( $task ); |
|
82 | + $manager->clean($task); |
|
83 | 83 | break; |
84 | 84 | default: |
85 | - throw new \Exception( sprintf( 'Invalid setup action "%1$s"', $input->getOption( 'action' ) ) ); |
|
85 | + throw new \Exception(sprintf('Invalid setup action "%1$s"', $input->getOption('action'))); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | * @param \Aimeos\MW\Config\Iface $conf Config object |
94 | 94 | * @return array Multi-dimensional associative list of database configuration parameters |
95 | 95 | */ |
96 | - protected function getDbConfig( \Aimeos\MW\Config\Iface $conf ) |
|
96 | + protected function getDbConfig(\Aimeos\MW\Config\Iface $conf) |
|
97 | 97 | { |
98 | - $dbconfig = $conf->get( 'resource', array() ); |
|
98 | + $dbconfig = $conf->get('resource', array()); |
|
99 | 99 | |
100 | - foreach( $dbconfig as $rname => $dbconf ) |
|
100 | + foreach ($dbconfig as $rname => $dbconf) |
|
101 | 101 | { |
102 | - if( strncmp( $rname, 'db', 2 ) !== 0 ) { |
|
103 | - unset( $dbconfig[$rname] ); |
|
102 | + if (strncmp($rname, 'db', 2) !== 0) { |
|
103 | + unset($dbconfig[$rname]); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | * @param array Associative list of database configurations |
117 | 117 | * @throws \RuntimeException If the format of the options is invalid |
118 | 118 | */ |
119 | - protected function setOptions( \Aimeos\MW\Config\Iface $conf, InputInterface $input ) |
|
119 | + protected function setOptions(\Aimeos\MW\Config\Iface $conf, InputInterface $input) |
|
120 | 120 | { |
121 | - foreach( (array) $input->getOption( 'option' ) as $option ) |
|
121 | + foreach ((array) $input->getOption('option') as $option) |
|
122 | 122 | { |
123 | - list( $name, $value ) = explode( ':', $option ); |
|
124 | - $conf->set( str_replace( '\\', '/', $name ), $value ); |
|
123 | + list($name, $value) = explode(':', $option); |
|
124 | + $conf->set(str_replace('\\', '/', $name), $value); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | */ |
32 | 32 | protected function configure() |
33 | 33 | { |
34 | - $this->setName( self::$defaultName ); |
|
35 | - $this->setDescription( 'Clears the content cache' ); |
|
36 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)' ); |
|
34 | + $this->setName(self::$defaultName); |
|
35 | + $this->setDescription('Clears the content cache'); |
|
36 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -43,26 +43,26 @@ discard block |
||
43 | 43 | * @param InputInterface $input Input object |
44 | 44 | * @param OutputInterface $output Output object |
45 | 45 | */ |
46 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
46 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
47 | 47 | { |
48 | - $context = $this->getContainer()->get( 'aimeos_context' )->get( false, 'command' ); |
|
49 | - $context->setEditor( 'aimeos:cache' ); |
|
48 | + $context = $this->getContainer()->get('aimeos_context')->get(false, 'command'); |
|
49 | + $context->setEditor('aimeos:cache'); |
|
50 | 50 | |
51 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
51 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
52 | 52 | |
53 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
53 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
54 | 54 | { |
55 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
55 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
56 | 56 | |
57 | 57 | $lcontext = clone $context; |
58 | - $lcontext->setLocale( $localeItem ); |
|
58 | + $lcontext->setLocale($localeItem); |
|
59 | 59 | |
60 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext ); |
|
61 | - $lcontext->setCache( $cache ); |
|
60 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext); |
|
61 | + $lcontext->setCache($cache); |
|
62 | 62 | |
63 | - $output->writeln( sprintf( 'Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode() ) ); |
|
63 | + $output->writeln(sprintf('Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode())); |
|
64 | 64 | |
65 | - \Aimeos\MAdmin\Cache\Manager\Factory::createManager( $lcontext )->getCache()->clear(); |
|
65 | + \Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->clear(); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | */ |
33 | 33 | protected function configure() |
34 | 34 | { |
35 | - $this->setName( self::$defaultName ); |
|
36 | - $this->setDescription( 'Creates new (admin) accounts' ); |
|
37 | - $this->addArgument( 'email', InputArgument::REQUIRED, 'E-mail address of the account that should be created' ); |
|
38 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default"', 'default' ); |
|
39 | - $this->addOption( 'password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)' ); |
|
40 | - $this->addOption( 'super', null, InputOption::VALUE_NONE, 'If account should have super user privileges' ); |
|
41 | - $this->addOption( 'admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges' ); |
|
42 | - $this->addOption( 'editor', null, InputOption::VALUE_NONE, 'If account should have limited editor privileges' ); |
|
35 | + $this->setName(self::$defaultName); |
|
36 | + $this->setDescription('Creates new (admin) accounts'); |
|
37 | + $this->addArgument('email', InputArgument::REQUIRED, 'E-mail address of the account that should be created'); |
|
38 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default"', 'default'); |
|
39 | + $this->addOption('password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)'); |
|
40 | + $this->addOption('super', null, InputOption::VALUE_NONE, 'If account should have super user privileges'); |
|
41 | + $this->addOption('admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges'); |
|
42 | + $this->addOption('editor', null, InputOption::VALUE_NONE, 'If account should have limited editor privileges'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -49,50 +49,50 @@ discard block |
||
49 | 49 | * @param InputInterface $input Input object |
50 | 50 | * @param OutputInterface $output Output object |
51 | 51 | */ |
52 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
52 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
53 | 53 | { |
54 | - $code = $input->getArgument( 'email' ); |
|
55 | - if( ( $password = $input->getOption( 'password' ) ) === null ) |
|
54 | + $code = $input->getArgument('email'); |
|
55 | + if (($password = $input->getOption('password')) === null) |
|
56 | 56 | { |
57 | - $helper = $this->getHelper( 'question' ); |
|
58 | - $question = new Question( 'Password' ); |
|
59 | - $question->setHidden( true ); |
|
57 | + $helper = $this->getHelper('question'); |
|
58 | + $question = new Question('Password'); |
|
59 | + $question->setHidden(true); |
|
60 | 60 | |
61 | - $password = $helper->ask( $input, $output, $question ); |
|
61 | + $password = $helper->ask($input, $output, $question); |
|
62 | 62 | } |
63 | 63 | |
64 | - $context = $this->getContainer()->get( 'aimeos_context' )->get( false, 'command' ); |
|
65 | - $context->setEditor( 'aimeos:account' ); |
|
64 | + $context = $this->getContainer()->get('aimeos_context')->get(false, 'command'); |
|
65 | + $context->setEditor('aimeos:account'); |
|
66 | 66 | |
67 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
68 | - $localeItem = $localeManager->bootstrap( $input->getArgument( 'site' ), '', '', false ); |
|
69 | - $context->setLocale( $localeItem ); |
|
67 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
68 | + $localeItem = $localeManager->bootstrap($input->getArgument('site'), '', '', false); |
|
69 | + $context->setLocale($localeItem); |
|
70 | 70 | |
71 | - $user = $this->createCustomerItem( $context, $code, $password ); |
|
71 | + $user = $this->createCustomerItem($context, $code, $password); |
|
72 | 72 | |
73 | - if( $input->getOption( 'admin' ) ) { |
|
74 | - $this->addGroup( $input, $output, $context, $user, 'admin' ); |
|
73 | + if ($input->getOption('admin')) { |
|
74 | + $this->addGroup($input, $output, $context, $user, 'admin'); |
|
75 | 75 | } |
76 | 76 | |
77 | - if( $input->getOption( 'editor' ) ) { |
|
78 | - $this->addGroup( $input, $output, $context, $user, 'editor' ); |
|
77 | + if ($input->getOption('editor')) { |
|
78 | + $this->addGroup($input, $output, $context, $user, 'editor'); |
|
79 | 79 | } |
80 | 80 | |
81 | - if( $this->getContainer()->has( 'fos_user.user_manager' ) ) |
|
81 | + if ($this->getContainer()->has('fos_user.user_manager')) |
|
82 | 82 | { |
83 | - $userManager = $this->getContainer()->get( 'fos_user.user_manager' ); |
|
84 | - $fosUser = $userManager->findUserByUsername( $code ); |
|
85 | - $fosUser->setSuperAdmin( false ); |
|
83 | + $userManager = $this->getContainer()->get('fos_user.user_manager'); |
|
84 | + $fosUser = $userManager->findUserByUsername($code); |
|
85 | + $fosUser->setSuperAdmin(false); |
|
86 | 86 | |
87 | - if( $input->getOption( 'super' ) ) { |
|
88 | - $fosUser->setSuperAdmin( true ); |
|
87 | + if ($input->getOption('super')) { |
|
88 | + $fosUser->setSuperAdmin(true); |
|
89 | 89 | } |
90 | 90 | |
91 | - if( $input->getOption( 'admin' ) || $input->getOption( 'editor' ) ) { |
|
92 | - $fosUser->addRole( 'ROLE_ADMIN' ); |
|
91 | + if ($input->getOption('admin') || $input->getOption('editor')) { |
|
92 | + $fosUser->addRole('ROLE_ADMIN'); |
|
93 | 93 | } |
94 | 94 | |
95 | - $userManager->updateUser( $fosUser ); |
|
95 | + $userManager->updateUser($fosUser); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -106,24 +106,24 @@ discard block |
||
106 | 106 | * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object |
107 | 107 | * @param string $group Unique customer group code |
108 | 108 | */ |
109 | - protected function addGroup( InputInterface $input, OutputInterface $output, |
|
110 | - \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group ) |
|
109 | + protected function addGroup(InputInterface $input, OutputInterface $output, |
|
110 | + \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group) |
|
111 | 111 | { |
112 | - $output->writeln( sprintf( 'Add "%1$s" group to user "%2$s" for sites', $group, $user->getCode() ) ); |
|
112 | + $output->writeln(sprintf('Add "%1$s" group to user "%2$s" for sites', $group, $user->getCode())); |
|
113 | 113 | |
114 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
114 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
115 | 115 | |
116 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
116 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
117 | 117 | { |
118 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
118 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
119 | 119 | |
120 | 120 | $lcontext = clone $context; |
121 | - $lcontext->setLocale( $localeItem ); |
|
121 | + $lcontext->setLocale($localeItem); |
|
122 | 122 | |
123 | - $output->writeln( '- ' . $siteItem->getCode() ); |
|
123 | + $output->writeln('- '.$siteItem->getCode()); |
|
124 | 124 | |
125 | - $groupItem = $this->getGroupItem( $lcontext, $group ); |
|
126 | - $this->addListItem( $lcontext, $user->getId(), $groupItem->getId() ); |
|
125 | + $groupItem = $this->getGroupItem($lcontext, $group); |
|
126 | + $this->addListItem($lcontext, $user->getId(), $groupItem->getId()); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -135,31 +135,31 @@ discard block |
||
135 | 135 | * @param string $userid Unique user ID |
136 | 136 | * @param string $groupid Unique group ID |
137 | 137 | */ |
138 | - protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid ) |
|
138 | + protected function addListItem(\Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid) |
|
139 | 139 | { |
140 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'lists' ); |
|
141 | - $typeid = $manager->getSubmanager( 'type' )->findItem( 'default', array(), 'customer/group' )->getId(); |
|
140 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('lists'); |
|
141 | + $typeid = $manager->getSubmanager('type')->findItem('default', array(), 'customer/group')->getId(); |
|
142 | 142 | |
143 | 143 | $search = $manager->createSearch(); |
144 | 144 | $expr = array( |
145 | - $search->compare( '==', 'customer.lists.parentid', $userid ), |
|
146 | - $search->compare( '==', 'customer.lists.refid', $groupid ), |
|
147 | - $search->compare( '==', 'customer.lists.domain', 'customer/group' ), |
|
148 | - $search->compare( '==', 'customer.lists.typeid', $typeid ), |
|
145 | + $search->compare('==', 'customer.lists.parentid', $userid), |
|
146 | + $search->compare('==', 'customer.lists.refid', $groupid), |
|
147 | + $search->compare('==', 'customer.lists.domain', 'customer/group'), |
|
148 | + $search->compare('==', 'customer.lists.typeid', $typeid), |
|
149 | 149 | ); |
150 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
151 | - $search->setSlice( 0, 1 ); |
|
150 | + $search->setConditions($search->combine('&&', $expr)); |
|
151 | + $search->setSlice(0, 1); |
|
152 | 152 | |
153 | - if( count( $manager->searchItems( $search ) ) === 0 ) |
|
153 | + if (count($manager->searchItems($search)) === 0) |
|
154 | 154 | { |
155 | 155 | $item = $manager->createItem(); |
156 | - $item->setDomain( 'customer/group' ); |
|
157 | - $item->setParentId( $userid ); |
|
158 | - $item->setTypeId( $typeid ); |
|
159 | - $item->setRefId( $groupid ); |
|
160 | - $item->setStatus( 1 ); |
|
156 | + $item->setDomain('customer/group'); |
|
157 | + $item->setParentId($userid); |
|
158 | + $item->setTypeId($typeid); |
|
159 | + $item->setRefId($groupid); |
|
160 | + $item->setStatus(1); |
|
161 | 161 | |
162 | - $manager->saveItem( $item, false ); |
|
162 | + $manager->saveItem($item, false); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
@@ -174,23 +174,23 @@ discard block |
||
174 | 174 | * @param string $password New user password |
175 | 175 | * @return \Aimeos\MShop\Customer\Item\Iface Aimeos customer item object |
176 | 176 | */ |
177 | - protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password ) |
|
177 | + protected function createCustomerItem(\Aimeos\MShop\Context\Item\Iface $context, $email, $password) |
|
178 | 178 | { |
179 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
179 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
180 | 180 | |
181 | 181 | try { |
182 | - $item = $manager->findItem( $email ); |
|
183 | - } catch( \Aimeos\MShop\Exception $e ) { |
|
182 | + $item = $manager->findItem($email); |
|
183 | + } catch (\Aimeos\MShop\Exception $e) { |
|
184 | 184 | $item = $manager->createItem(); |
185 | 185 | } |
186 | 186 | |
187 | - $item->setCode( $email ); |
|
188 | - $item->setLabel( $email ); |
|
189 | - $item->getPaymentAddress()->setEmail( $email ); |
|
190 | - $item->setPassword( $password ); |
|
191 | - $item->setStatus( 1 ); |
|
187 | + $item->setCode($email); |
|
188 | + $item->setLabel($email); |
|
189 | + $item->getPaymentAddress()->setEmail($email); |
|
190 | + $item->setPassword($password); |
|
191 | + $item->setStatus(1); |
|
192 | 192 | |
193 | - $manager->saveItem( $item ); |
|
193 | + $manager->saveItem($item); |
|
194 | 194 | |
195 | 195 | return $item; |
196 | 196 | } |
@@ -203,21 +203,21 @@ discard block |
||
203 | 203 | * @param string $code Unique customer group code |
204 | 204 | * @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object |
205 | 205 | */ |
206 | - protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code ) |
|
206 | + protected function getGroupItem(\Aimeos\MShop\Context\Item\Iface $context, $code) |
|
207 | 207 | { |
208 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'group' ); |
|
208 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('group'); |
|
209 | 209 | |
210 | 210 | try |
211 | 211 | { |
212 | - $item = $manager->findItem( $code ); |
|
212 | + $item = $manager->findItem($code); |
|
213 | 213 | } |
214 | - catch( \Aimeos\MShop\Exception $e ) |
|
214 | + catch (\Aimeos\MShop\Exception $e) |
|
215 | 215 | { |
216 | 216 | $item = $manager->createItem(); |
217 | - $item->setLabel( $code ); |
|
218 | - $item->setCode( $code ); |
|
217 | + $item->setLabel($code); |
|
218 | + $item->setCode($code); |
|
219 | 219 | |
220 | - $manager->saveItem( $item ); |
|
220 | + $manager->saveItem($item); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | return $item; |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | protected function configure() |
33 | 33 | { |
34 | 34 | $names = ''; |
35 | - $aimeos = new \Aimeos\Bootstrap( array() ); |
|
36 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/jobs' ); |
|
37 | - $controllers = \Aimeos\Controller\Jobs\Factory::getControllers( $this->getBareContext(), $aimeos, $cntlPaths ); |
|
35 | + $aimeos = new \Aimeos\Bootstrap(array()); |
|
36 | + $cntlPaths = $aimeos->getCustomPaths('controller/jobs'); |
|
37 | + $controllers = \Aimeos\Controller\Jobs\Factory::getControllers($this->getBareContext(), $aimeos, $cntlPaths); |
|
38 | 38 | |
39 | - foreach( $controllers as $key => $controller ) { |
|
40 | - $names .= str_pad( $key, 30 ) . $controller->getName() . PHP_EOL; |
|
39 | + foreach ($controllers as $key => $controller) { |
|
40 | + $names .= str_pad($key, 30).$controller->getName().PHP_EOL; |
|
41 | 41 | } |
42 | 42 | |
43 | - $this->setName( self::$defaultName ); |
|
44 | - $this->setDescription( 'Executes the job controllers' ); |
|
45 | - $this->addArgument( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' ); |
|
46 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' ); |
|
47 | - $this->setHelp( "Available jobs are:\n" . $names ); |
|
43 | + $this->setName(self::$defaultName); |
|
44 | + $this->setDescription('Executes the job controllers'); |
|
45 | + $this->addArgument('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"'); |
|
46 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)'); |
|
47 | + $this->setHelp("Available jobs are:\n".$names); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -54,32 +54,32 @@ discard block |
||
54 | 54 | * @param InputInterface $input Input object |
55 | 55 | * @param OutputInterface $output Output object |
56 | 56 | */ |
57 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
57 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
58 | 58 | { |
59 | 59 | $context = $this->getContext(); |
60 | 60 | $process = $context->getProcess(); |
61 | - $aimeos = $this->getContainer()->get( 'aimeos' )->get(); |
|
61 | + $aimeos = $this->getContainer()->get('aimeos')->get(); |
|
62 | 62 | |
63 | - $jobs = explode( ' ', $input->getArgument( 'jobs' ) ); |
|
64 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
63 | + $jobs = explode(' ', $input->getArgument('jobs')); |
|
64 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
65 | 65 | |
66 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
66 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
67 | 67 | { |
68 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
69 | - $localeItem->setLanguageId( null ); |
|
70 | - $localeItem->setCurrencyId( null ); |
|
68 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
69 | + $localeItem->setLanguageId(null); |
|
70 | + $localeItem->setCurrencyId(null); |
|
71 | 71 | |
72 | - $context->setLocale( $localeItem ); |
|
72 | + $context->setLocale($localeItem); |
|
73 | 73 | |
74 | - $output->writeln( sprintf( 'Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode() ) ); |
|
74 | + $output->writeln(sprintf('Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode())); |
|
75 | 75 | |
76 | - foreach( $jobs as $jobname ) |
|
76 | + foreach ($jobs as $jobname) |
|
77 | 77 | { |
78 | - $fcn = function( $context, $aimeos, $jobname ) { |
|
79 | - \Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run(); |
|
78 | + $fcn = function($context, $aimeos, $jobname) { |
|
79 | + \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run(); |
|
80 | 80 | }; |
81 | 81 | |
82 | - $process->start( $fcn, [$context, $aimeos, $jobname], true ); |
|
82 | + $process->start($fcn, [$context, $aimeos, $jobname], true); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | { |
97 | 97 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
98 | 98 | |
99 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), array() ); |
|
100 | - $ctx->setConfig( $conf ); |
|
99 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), array()); |
|
100 | + $ctx->setConfig($conf); |
|
101 | 101 | |
102 | - $locale = \Aimeos\MShop\Factory::createManager( $ctx, 'locale' )->createItem(); |
|
103 | - $locale->setLanguageId( 'en' ); |
|
104 | - $ctx->setLocale( $locale ); |
|
102 | + $locale = \Aimeos\MShop\Factory::createManager($ctx, 'locale')->createItem(); |
|
103 | + $locale->setLanguageId('en'); |
|
104 | + $ctx->setLocale($locale); |
|
105 | 105 | |
106 | - $i18n = new \Aimeos\MW\Translation\None( 'en' ); |
|
107 | - $ctx->setI18n( array( 'en' => $i18n ) ); |
|
106 | + $i18n = new \Aimeos\MW\Translation\None('en'); |
|
107 | + $ctx->setI18n(array('en' => $i18n)); |
|
108 | 108 | |
109 | 109 | return $ctx; |
110 | 110 | } |
@@ -119,19 +119,19 @@ discard block |
||
119 | 119 | { |
120 | 120 | $container = $this->getContainer(); |
121 | 121 | $aimeos = $container->get('aimeos')->get(); |
122 | - $context = $container->get( 'aimeos_context' )->get( false, 'command' ); |
|
122 | + $context = $container->get('aimeos_context')->get(false, 'command'); |
|
123 | 123 | |
124 | - $tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' ); |
|
125 | - $tmplPaths = array_merge( $tmplPaths, $aimeos->getCustomPaths( 'client/html/templates' ) ); |
|
126 | - $view = $container->get('aimeos_view')->create( $context, $tmplPaths ); |
|
124 | + $tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates'); |
|
125 | + $tmplPaths = array_merge($tmplPaths, $aimeos->getCustomPaths('client/html/templates')); |
|
126 | + $view = $container->get('aimeos_view')->create($context, $tmplPaths); |
|
127 | 127 | |
128 | - $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' ); |
|
129 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
130 | - $i18n = $this->getContainer()->get( 'aimeos_i18n' )->get( $langids ); |
|
128 | + $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language'); |
|
129 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
130 | + $i18n = $this->getContainer()->get('aimeos_i18n')->get($langids); |
|
131 | 131 | |
132 | - $context->setEditor( 'aimeos:jobs' ); |
|
133 | - $context->setView( $view ); |
|
134 | - $context->setI18n( $i18n ); |
|
132 | + $context->setEditor('aimeos:jobs'); |
|
133 | + $context->setView($view); |
|
134 | + $context->setI18n($i18n); |
|
135 | 135 | |
136 | 136 | return $context; |
137 | 137 | } |