@@ -29,25 +29,25 @@ |
||
29 | 29 | public function getConfigTreeBuilder() |
30 | 30 | { |
31 | 31 | $treeBuilder = new TreeBuilder(); |
32 | - $rootNode = $treeBuilder->root( 'aimeos_shop' ); |
|
32 | + $rootNode = $treeBuilder->root('aimeos_shop'); |
|
33 | 33 | |
34 | 34 | $rootNode |
35 | 35 | ->children() |
36 | - ->booleanNode('disable_sites')->defaultValue( true )->end() |
|
37 | - ->booleanNode('apc_enable')->defaultValue( false )->end() |
|
38 | - ->scalarNode('apc_prefix')->defaultValue( 'sf2:' )->end() |
|
36 | + ->booleanNode('disable_sites')->defaultValue(true)->end() |
|
37 | + ->booleanNode('apc_enable')->defaultValue(false)->end() |
|
38 | + ->scalarNode('apc_prefix')->defaultValue('sf2:')->end() |
|
39 | 39 | ->scalarNode('extdir')->end() |
40 | 40 | ->scalarNode('uploaddir')->end() |
41 | - ->variableNode('admin')->defaultValue( array() )->end() |
|
42 | - ->variableNode('client')->defaultValue( array() )->end() |
|
43 | - ->variableNode('controller')->defaultValue( array() )->end() |
|
44 | - ->variableNode('i18n')->defaultValue( array() )->end() |
|
45 | - ->variableNode('madmin')->defaultValue( array() )->end() |
|
46 | - ->variableNode('mshop')->defaultValue( array() )->end() |
|
47 | - ->variableNode('resource')->defaultValue( array() )->end() |
|
48 | - ->variableNode('page')->defaultValue( array() )->end() |
|
49 | - ->variableNode('backend')->defaultValue( array() )->end() |
|
50 | - ->variableNode('frontend')->defaultValue( array() )->end() |
|
41 | + ->variableNode('admin')->defaultValue(array())->end() |
|
42 | + ->variableNode('client')->defaultValue(array())->end() |
|
43 | + ->variableNode('controller')->defaultValue(array())->end() |
|
44 | + ->variableNode('i18n')->defaultValue(array())->end() |
|
45 | + ->variableNode('madmin')->defaultValue(array())->end() |
|
46 | + ->variableNode('mshop')->defaultValue(array())->end() |
|
47 | + ->variableNode('resource')->defaultValue(array())->end() |
|
48 | + ->variableNode('page')->defaultValue(array())->end() |
|
49 | + ->variableNode('backend')->defaultValue(array())->end() |
|
50 | + ->variableNode('frontend')->defaultValue(array())->end() |
|
51 | 51 | ->end() |
52 | 52 | ; |
53 | 53 |
@@ -31,15 +31,15 @@ discard block |
||
31 | 31 | * @param string $site Unique site code |
32 | 32 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
33 | 33 | */ |
34 | - public function deleteAction( Request $request, $resource, $site = 'default' ) |
|
34 | + public function deleteAction(Request $request, $resource, $site = 'default') |
|
35 | 35 | { |
36 | 36 | $status = 500; |
37 | 37 | $header = $request->headers->all(); |
38 | 38 | |
39 | - $client = $this->createClient( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
40 | - $result = $client->delete( $request->getContent(), $header, $status ); |
|
39 | + $client = $this->createClient($site, $resource, $request->get('lang', 'en')); |
|
40 | + $result = $client->delete($request->getContent(), $header, $status); |
|
41 | 41 | |
42 | - return $this->createResponse( $result, $status, $header ); |
|
42 | + return $this->createResponse($result, $status, $header); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | * @param string $site Unique site code |
52 | 52 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
53 | 53 | */ |
54 | - public function getAction( Request $request, $resource, $site = 'default' ) |
|
54 | + public function getAction(Request $request, $resource, $site = 'default') |
|
55 | 55 | { |
56 | 56 | $status = 500; |
57 | 57 | $header = $request->headers->all(); |
58 | 58 | |
59 | - $client = $this->createClient( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
60 | - $result = $client->get( $request->getContent(), $header, $status ); |
|
59 | + $client = $this->createClient($site, $resource, $request->get('lang', 'en')); |
|
60 | + $result = $client->get($request->getContent(), $header, $status); |
|
61 | 61 | |
62 | - return $this->createResponse( $result, $status, $header ); |
|
62 | + return $this->createResponse($result, $status, $header); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | * @param string $site Unique site code |
72 | 72 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
73 | 73 | */ |
74 | - public function patchAction( Request $request, $resource, $site = 'default' ) |
|
74 | + public function patchAction(Request $request, $resource, $site = 'default') |
|
75 | 75 | { |
76 | 76 | $status = 500; |
77 | 77 | $header = $request->headers->all(); |
78 | 78 | |
79 | - $client = $this->createClient( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
80 | - $result = $client->patch( $request->getContent(), $header, $status ); |
|
79 | + $client = $this->createClient($site, $resource, $request->get('lang', 'en')); |
|
80 | + $result = $client->patch($request->getContent(), $header, $status); |
|
81 | 81 | |
82 | - return $this->createResponse( $result, $status, $header ); |
|
82 | + return $this->createResponse($result, $status, $header); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | * @param string $site Unique site code |
92 | 92 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
93 | 93 | */ |
94 | - public function postAction( Request $request, $resource, $site = 'default' ) |
|
94 | + public function postAction(Request $request, $resource, $site = 'default') |
|
95 | 95 | { |
96 | 96 | $status = 500; |
97 | 97 | $header = $request->headers->all(); |
98 | 98 | |
99 | - $client = $this->createClient( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
100 | - $result = $client->post( $request->getContent(), $header, $status ); |
|
99 | + $client = $this->createClient($site, $resource, $request->get('lang', 'en')); |
|
100 | + $result = $client->post($request->getContent(), $header, $status); |
|
101 | 101 | |
102 | - return $this->createResponse( $result, $status, $header ); |
|
102 | + return $this->createResponse($result, $status, $header); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | * @param string $site Unique site code |
112 | 112 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
113 | 113 | */ |
114 | - public function putAction( Request $request, $resource, $site = 'default' ) |
|
114 | + public function putAction(Request $request, $resource, $site = 'default') |
|
115 | 115 | { |
116 | 116 | $status = 500; |
117 | 117 | $header = $request->headers->all(); |
118 | 118 | |
119 | - $client = $this->createClient( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
120 | - $result = $client->put( $request->getContent(), $header, $status ); |
|
119 | + $client = $this->createClient($site, $resource, $request->get('lang', 'en')); |
|
120 | + $result = $client->put($request->getContent(), $header, $status); |
|
121 | 121 | |
122 | - return $this->createResponse( $result, $status, $header ); |
|
122 | + return $this->createResponse($result, $status, $header); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | * @param string $site Unique site code |
132 | 132 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
133 | 133 | */ |
134 | - public function optionsAction( Request $request, $resource = '', $site = 'default' ) |
|
134 | + public function optionsAction(Request $request, $resource = '', $site = 'default') |
|
135 | 135 | { |
136 | 136 | $status = 500; |
137 | 137 | $header = $request->headers->all(); |
138 | 138 | |
139 | - $client = $this->createClient( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
140 | - $result = $client->options( $request->getContent(), $header, $status ); |
|
139 | + $client = $this->createClient($site, $resource, $request->get('lang', 'en')); |
|
140 | + $result = $client->options($request->getContent(), $header, $status); |
|
141 | 141 | |
142 | - return $this->createResponse( $result, $status, $header ); |
|
142 | + return $this->createResponse($result, $status, $header); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -151,18 +151,18 @@ discard block |
||
151 | 151 | * @param string $lang Language code |
152 | 152 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
153 | 153 | */ |
154 | - protected function createClient( $site, $resource, $lang ) |
|
154 | + protected function createClient($site, $resource, $lang) |
|
155 | 155 | { |
156 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
157 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jsonadm/templates' ); |
|
156 | + $aimeos = $this->get('aimeos')->get(); |
|
157 | + $templatePaths = $aimeos->getCustomPaths('admin/jsonadm/templates'); |
|
158 | 158 | |
159 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
160 | - $context = $this->setLocale( $context, $site, $lang ); |
|
159 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
160 | + $context = $this->setLocale($context, $site, $lang); |
|
161 | 161 | |
162 | - $view = $this->get('aimeos_view')->create( $context, $templatePaths, $lang ); |
|
163 | - $context->setView( $view ); |
|
162 | + $view = $this->get('aimeos_view')->create($context, $templatePaths, $lang); |
|
163 | + $context->setView($view); |
|
164 | 164 | |
165 | - return \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
165 | + return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -174,14 +174,14 @@ discard block |
||
174 | 174 | * @param array $header List of HTTP headers |
175 | 175 | * @return Response HTTP response object |
176 | 176 | */ |
177 | - protected function createResponse( $content, $status, array $header ) |
|
177 | + protected function createResponse($content, $status, array $header) |
|
178 | 178 | { |
179 | 179 | $response = new Response(); |
180 | - $response->setContent( $content ); |
|
181 | - $response->setStatusCode( $status ); |
|
180 | + $response->setContent($content); |
|
181 | + $response->setStatusCode($status); |
|
182 | 182 | |
183 | - foreach( $header as $key => $value ) { |
|
184 | - $response->headers->set( $key, $value ); |
|
183 | + foreach ($header as $key => $value) { |
|
184 | + $response->headers->set($key, $value); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | return $response; |
@@ -196,23 +196,23 @@ discard block |
||
196 | 196 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
197 | 197 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
198 | 198 | */ |
199 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site, $lang ) |
|
199 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site, $lang) |
|
200 | 200 | { |
201 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
201 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
202 | 202 | |
203 | 203 | try |
204 | 204 | { |
205 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
206 | - $localeItem->setLanguageId( null ); |
|
207 | - $localeItem->setCurrencyId( null ); |
|
205 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
206 | + $localeItem->setLanguageId(null); |
|
207 | + $localeItem->setCurrencyId(null); |
|
208 | 208 | } |
209 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
209 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
210 | 210 | { |
211 | 211 | $localeItem = $localeManager->createItem(); |
212 | 212 | } |
213 | 213 | |
214 | - $context->setLocale( $localeItem ); |
|
215 | - $context->setI18n( $this->get('aimeos_i18n')->get( array( $lang ) ) ); |
|
214 | + $context->setLocale($localeItem); |
|
215 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang))); |
|
216 | 216 | |
217 | 217 | return $context; |
218 | 218 | } |
@@ -30,63 +30,63 @@ discard block |
||
30 | 30 | * @param Request $request Symfony request object |
31 | 31 | * @return Response Generated output for the admin interface |
32 | 32 | */ |
33 | - public function indexAction( Request $request ) |
|
33 | + public function indexAction(Request $request) |
|
34 | 34 | { |
35 | - $site = $request->attributes->get( 'site', $request->query->get( 'site', 'default' ) ); |
|
36 | - $lang = $request->attributes->get( 'lang', $request->query->get( 'lang', 'en' ) ); |
|
37 | - $tab = $request->attributes->get( 'tab', $request->query->get( 'tab', 0 ) ); |
|
35 | + $site = $request->attributes->get('site', $request->query->get('site', 'default')); |
|
36 | + $lang = $request->attributes->get('lang', $request->query->get('lang', 'en')); |
|
37 | + $tab = $request->attributes->get('tab', $request->query->get('tab', 0)); |
|
38 | 38 | |
39 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
40 | - $context = $this->setLocale( $context, $site, $lang ); |
|
39 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
40 | + $context = $this->setLocale($context, $site, $lang); |
|
41 | 41 | |
42 | - $aimeos = $this->get( 'aimeos' ); |
|
42 | + $aimeos = $this->get('aimeos'); |
|
43 | 43 | $bootstrap = $aimeos->get(); |
44 | 44 | |
45 | - $cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' ); |
|
46 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
45 | + $cntlPaths = $bootstrap->getCustomPaths('controller/extjs'); |
|
46 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
47 | 47 | $cssFiles = array(); |
48 | 48 | |
49 | - foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
49 | + foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths) |
|
50 | 50 | { |
51 | - foreach( $paths as $path ) |
|
51 | + foreach ($paths as $path) |
|
52 | 52 | { |
53 | - $jsbAbsPath = $base . '/' . $path; |
|
53 | + $jsbAbsPath = $base.'/'.$path; |
|
54 | 54 | |
55 | - if( !is_file( $jsbAbsPath ) ) { |
|
56 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
55 | + if (!is_file($jsbAbsPath)) { |
|
56 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
57 | 57 | } |
58 | 58 | |
59 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
60 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
59 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
60 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | - $params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' ); |
|
65 | - $adminUrl = $this->generateUrl( 'aimeos_shop_extadm', $params ); |
|
64 | + $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); |
|
65 | + $adminUrl = $this->generateUrl('aimeos_shop_extadm', $params); |
|
66 | 66 | |
67 | - $token = $this->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' )->getValue(); |
|
68 | - $jsonUrl = $this->generateUrl( 'aimeos_shop_extadm_json', array( '_token' => $token, 'site' => $site ) ); |
|
67 | + $token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue(); |
|
68 | + $jsonUrl = $this->generateUrl('aimeos_shop_extadm_json', array('_token' => $token, 'site' => $site)); |
|
69 | 69 | |
70 | - $jqadmUrl = $this->generateUrl( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) ); |
|
70 | + $jqadmUrl = $this->generateUrl('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product')); |
|
71 | 71 | |
72 | 72 | $vars = array( |
73 | 73 | 'lang' => $lang, |
74 | 74 | 'cssFiles' => $cssFiles, |
75 | 75 | 'languages' => $this->getJsonLanguages(), |
76 | - 'config' => $this->getJsonClientConfig( $context ), |
|
77 | - 'site' => $this->getJsonSiteItem( $context, $site ), |
|
78 | - 'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ), |
|
76 | + 'config' => $this->getJsonClientConfig($context), |
|
77 | + 'site' => $this->getJsonSiteItem($context, $site), |
|
78 | + 'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang), |
|
79 | 79 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
80 | 80 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
81 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
82 | - 'urlTemplate' => urldecode( $adminUrl ), |
|
83 | - 'uploaddir' => $this->container->getParameter( 'aimeos_shop.uploaddir' ), |
|
81 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
82 | + 'urlTemplate' => urldecode($adminUrl), |
|
83 | + 'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'), |
|
84 | 84 | 'version' => $aimeos->getVersion(), |
85 | 85 | 'jqadmurl' => $jqadmUrl, |
86 | 86 | 'activeTab' => $tab, |
87 | 87 | ); |
88 | 88 | |
89 | - return $this->render( 'AimeosShopBundle:Extadm:index.html.twig', $vars ); |
|
89 | + return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -96,23 +96,23 @@ discard block |
||
96 | 96 | * @param Request $request Symfony request object |
97 | 97 | * @return Response JSON RPC message response |
98 | 98 | */ |
99 | - public function doAction( Request $request ) |
|
99 | + public function doAction(Request $request) |
|
100 | 100 | { |
101 | 101 | $csrfProvider = $this->get('security.csrf.token_manager'); |
102 | 102 | |
103 | - if( $csrfProvider->isTokenValid( new CsrfToken( 'aimeos_admin_token', $request->query->get( '_token' ) ) ) !== true ) { |
|
104 | - throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException( 'CSRF token is invalid' ); |
|
103 | + if ($csrfProvider->isTokenValid(new CsrfToken('aimeos_admin_token', $request->query->get('_token'))) !== true) { |
|
104 | + throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException('CSRF token is invalid'); |
|
105 | 105 | } |
106 | 106 | |
107 | - $cntlPaths = $this->get( 'aimeos' )->get()->getCustomPaths( 'controller/extjs' ); |
|
108 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
109 | - $context->setView( $this->get( 'aimeos_view' )->create( $context, array() ) ); |
|
110 | - $context = $this->setLocale( $context ); |
|
107 | + $cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs'); |
|
108 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
109 | + $context->setView($this->get('aimeos_view')->create($context, array())); |
|
110 | + $context = $this->setLocale($context); |
|
111 | 111 | |
112 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
112 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
113 | 113 | |
114 | - $response = $controller->process( $request->request->all(), $request->getContent() ); |
|
115 | - return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) ); |
|
114 | + $response = $controller->process($request->request->all(), $request->getContent()); |
|
115 | + return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response)); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -125,27 +125,27 @@ discard block |
||
125 | 125 | { |
126 | 126 | $contents = ''; |
127 | 127 | $jsFiles = array(); |
128 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
128 | + $aimeos = $this->get('aimeos')->get(); |
|
129 | 129 | |
130 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
130 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
131 | 131 | { |
132 | - foreach( $paths as $path ) |
|
132 | + foreach ($paths as $path) |
|
133 | 133 | { |
134 | - $jsbAbsPath = $base . '/' . $path; |
|
135 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
136 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
134 | + $jsbAbsPath = $base.'/'.$path; |
|
135 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
136 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - foreach( $jsFiles as $file ) |
|
140 | + foreach ($jsFiles as $file) |
|
141 | 141 | { |
142 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
142 | + if (($content = file_get_contents($file)) !== false) { |
|
143 | 143 | $contents .= $content; |
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | - $response = new Response( $contents ); |
|
148 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
147 | + $response = new Response($contents); |
|
148 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
149 | 149 | |
150 | 150 | return $response; |
151 | 151 | } |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | { |
161 | 161 | $result = array(); |
162 | 162 | |
163 | - foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) { |
|
164 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
163 | + foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) { |
|
164 | + $result[] = array('id' => $id, 'label' => $id); |
|
165 | 165 | } |
166 | 166 | |
167 | - return json_encode( $result ); |
|
167 | + return json_encode($result); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
175 | 175 | * @return string JSON encoded configuration object |
176 | 176 | */ |
177 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
177 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
178 | 178 | { |
179 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
180 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
179 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
180 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
@@ -188,16 +188,16 @@ discard block |
||
188 | 188 | * @param string $lang ISO language code like "en" or "en_GB" |
189 | 189 | * @return string JSON encoded translation object |
190 | 190 | */ |
191 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
191 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
192 | 192 | { |
193 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang ); |
|
193 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang); |
|
194 | 194 | |
195 | 195 | $content = array( |
196 | - 'admin' => $i18n->getAll( 'admin' ), |
|
197 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
196 | + 'admin' => $i18n->getAll('admin'), |
|
197 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
198 | 198 | ); |
199 | 199 | |
200 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
200 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -209,19 +209,19 @@ discard block |
||
209 | 209 | * @return string JSON encoded site item object |
210 | 210 | * @throws Exception If no site item was found for the code |
211 | 211 | */ |
212 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
212 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
213 | 213 | { |
214 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
214 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
215 | 215 | |
216 | 216 | $criteria = $manager->createSearch(); |
217 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
218 | - $items = $manager->searchItems( $criteria ); |
|
217 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
218 | + $items = $manager->searchItems($criteria); |
|
219 | 219 | |
220 | - if( ( $item = reset( $items ) ) === false ) { |
|
221 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
220 | + if (($item = reset($items)) === false) { |
|
221 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
222 | 222 | } |
223 | 223 | |
224 | - return json_encode( $item->toArray() ); |
|
224 | + return json_encode($item->toArray()); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | |
@@ -233,17 +233,17 @@ discard block |
||
233 | 233 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
234 | 234 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
235 | 235 | */ |
236 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
236 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
237 | 237 | { |
238 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
238 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
239 | 239 | |
240 | 240 | try { |
241 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
242 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
241 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
242 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
243 | 243 | $localeItem = $localeManager->createItem(); |
244 | 244 | } |
245 | 245 | |
246 | - $context->setLocale( $localeItem ); |
|
246 | + $context->setLocale($localeItem); |
|
247 | 247 | |
248 | 248 | return $context; |
249 | 249 | } |
@@ -29,35 +29,35 @@ discard block |
||
29 | 29 | * @param $type File type, i.e. "css" or "js" |
30 | 30 | * @return Response Response object |
31 | 31 | */ |
32 | - public function fileAction( $type ) |
|
32 | + public function fileAction($type) |
|
33 | 33 | { |
34 | 34 | $contents = ''; |
35 | 35 | $files = array(); |
36 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
36 | + $aimeos = $this->get('aimeos')->get(); |
|
37 | 37 | |
38 | - foreach( $aimeos->getCustomPaths( 'admin/jqadm' ) as $base => $paths ) |
|
38 | + foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths) |
|
39 | 39 | { |
40 | - foreach( $paths as $path ) |
|
40 | + foreach ($paths as $path) |
|
41 | 41 | { |
42 | - $jsbAbsPath = $base . '/' . $path; |
|
43 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
44 | - $files = array_merge( $files, $jsb2->getFiles( $type ) ); |
|
42 | + $jsbAbsPath = $base.'/'.$path; |
|
43 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
44 | + $files = array_merge($files, $jsb2->getFiles($type)); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - foreach( $files as $file ) |
|
48 | + foreach ($files as $file) |
|
49 | 49 | { |
50 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
50 | + if (($content = file_get_contents($file)) !== false) { |
|
51 | 51 | $contents .= $content; |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - $response = new Response( $contents ); |
|
55 | + $response = new Response($contents); |
|
56 | 56 | |
57 | - if( $type === 'js' ) { |
|
58 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
59 | - } elseif( $type === 'css' ) { |
|
60 | - $response->headers->set( 'Content-Type', 'text/css' ); |
|
57 | + if ($type === 'js') { |
|
58 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
59 | + } elseif ($type === 'css') { |
|
60 | + $response->headers->set('Content-Type', 'text/css'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $response; |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | * @param string $site Unique site code |
73 | 73 | * @return Response Generated output |
74 | 74 | */ |
75 | - public function copyAction( Request $request, $resource, $site = 'default' ) |
|
75 | + public function copyAction(Request $request, $resource, $site = 'default') |
|
76 | 76 | { |
77 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
78 | - return $this->getHtml( $cntl->copy() ); |
|
77 | + $cntl = $this->createClient($request, $site, $resource); |
|
78 | + return $this->getHtml($cntl->copy()); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | * @param string $site Unique site code |
88 | 88 | * @return Response Generated output |
89 | 89 | */ |
90 | - public function createAction( Request $request, $resource, $site = 'default' ) |
|
90 | + public function createAction(Request $request, $resource, $site = 'default') |
|
91 | 91 | { |
92 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
93 | - return $this->getHtml( $cntl->create() ); |
|
92 | + $cntl = $this->createClient($request, $site, $resource); |
|
93 | + return $this->getHtml($cntl->create()); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | * @param string $site Unique site code |
103 | 103 | * @return Response Generated output |
104 | 104 | */ |
105 | - public function deleteAction( Request $request, $resource, $site = 'default' ) |
|
105 | + public function deleteAction(Request $request, $resource, $site = 'default') |
|
106 | 106 | { |
107 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
108 | - return $this->getHtml( $cntl->delete() . $cntl->search() ); |
|
107 | + $cntl = $this->createClient($request, $site, $resource); |
|
108 | + return $this->getHtml($cntl->delete().$cntl->search()); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | * @param string $site Unique site code |
118 | 118 | * @return Response Generated output |
119 | 119 | */ |
120 | - public function getAction( Request $request, $resource, $site = 'default' ) |
|
120 | + public function getAction(Request $request, $resource, $site = 'default') |
|
121 | 121 | { |
122 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
123 | - return $this->getHtml( $cntl->get() ); |
|
122 | + $cntl = $this->createClient($request, $site, $resource); |
|
123 | + return $this->getHtml($cntl->get()); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | * @param string $site Unique site code |
133 | 133 | * @return Response Generated output |
134 | 134 | */ |
135 | - public function saveAction( Request $request, $resource, $site = 'default' ) |
|
135 | + public function saveAction(Request $request, $resource, $site = 'default') |
|
136 | 136 | { |
137 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
138 | - return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) ); |
|
137 | + $cntl = $this->createClient($request, $site, $resource); |
|
138 | + return $this->getHtml(($cntl->save() ?: $cntl->search())); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | * @param string $site Unique site code |
148 | 148 | * @return Response Generated output |
149 | 149 | */ |
150 | - public function searchAction( Request $request, $resource, $site = 'default' ) |
|
150 | + public function searchAction(Request $request, $resource, $site = 'default') |
|
151 | 151 | { |
152 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
153 | - return $this->getHtml( $cntl->search() ); |
|
152 | + $cntl = $this->createClient($request, $site, $resource); |
|
153 | + return $this->getHtml($cntl->search()); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -162,20 +162,20 @@ discard block |
||
162 | 162 | * @param string $resource Resource location, e.g. "product" |
163 | 163 | * @return \Aimeos\Admin\JQAdm\Iface Context item |
164 | 164 | */ |
165 | - protected function createClient( Request $request, $site, $resource ) |
|
165 | + protected function createClient(Request $request, $site, $resource) |
|
166 | 166 | { |
167 | - $lang = $request->get( 'lang', 'en' ); |
|
167 | + $lang = $request->get('lang', 'en'); |
|
168 | 168 | |
169 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
170 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
169 | + $aimeos = $this->get('aimeos')->get(); |
|
170 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
171 | 171 | |
172 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
173 | - $context = $this->setLocale( $context, $site, $lang ); |
|
172 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
173 | + $context = $this->setLocale($context, $site, $lang); |
|
174 | 174 | |
175 | - $view = $this->get( 'aimeos_view' )->create( $context, $templatePaths, $lang ); |
|
176 | - $context->setView( $view ); |
|
175 | + $view = $this->get('aimeos_view')->create($context, $templatePaths, $lang); |
|
176 | + $context->setView($view); |
|
177 | 177 | |
178 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
178 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | * @param string $content Content from admin client |
186 | 186 | * @return Response View for rendering the output |
187 | 187 | */ |
188 | - protected function getHtml( $content ) |
|
188 | + protected function getHtml($content) |
|
189 | 189 | { |
190 | - $version = $this->get( 'aimeos' )->getVersion(); |
|
191 | - $content = str_replace( array( '{type}', '{version}' ), array( 'Symfony', $version ), $content ); |
|
190 | + $version = $this->get('aimeos')->getVersion(); |
|
191 | + $content = str_replace(array('{type}', '{version}'), array('Symfony', $version), $content); |
|
192 | 192 | |
193 | - return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) ); |
|
193 | + return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content)); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -202,23 +202,23 @@ discard block |
||
202 | 202 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
203 | 203 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
204 | 204 | */ |
205 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site, $lang ) |
|
205 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site, $lang) |
|
206 | 206 | { |
207 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
207 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
208 | 208 | |
209 | 209 | try |
210 | 210 | { |
211 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
212 | - $localeItem->setLanguageId( null ); |
|
213 | - $localeItem->setCurrencyId( null ); |
|
211 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
212 | + $localeItem->setLanguageId(null); |
|
213 | + $localeItem->setCurrencyId(null); |
|
214 | 214 | } |
215 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
215 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
216 | 216 | { |
217 | 217 | $localeItem = $localeManager->createItem(); |
218 | 218 | } |
219 | 219 | |
220 | - $context->setLocale( $localeItem ); |
|
221 | - $context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) ); |
|
220 | + $context->setLocale($localeItem); |
|
221 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang, 'en'))); |
|
222 | 222 | |
223 | 223 | return $context; |
224 | 224 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param Container $container Container object to access parameters |
30 | 30 | */ |
31 | - public function __construct( Container $container ) |
|
31 | + public function __construct(Container $container) |
|
32 | 32 | { |
33 | 33 | $this->container = $container; |
34 | 34 | } |
@@ -40,33 +40,33 @@ discard block |
||
40 | 40 | * @param string $type Configuration type ("frontend" or "backend") |
41 | 41 | * @return \Aimeos\MW\Config\Iface Config object |
42 | 42 | */ |
43 | - public function get( $type = 'frontend' ) |
|
43 | + public function get($type = 'frontend') |
|
44 | 44 | { |
45 | 45 | $configPaths = $this->container->get('aimeos')->get()->getConfigPaths(); |
46 | 46 | |
47 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $configPaths ); |
|
47 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $configPaths); |
|
48 | 48 | |
49 | - $apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' ); |
|
50 | - $prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' ); |
|
49 | + $apc = (bool) $this->container->getParameter('aimeos_shop.apc_enable'); |
|
50 | + $prefix = $this->container->getParameter('aimeos_shop.apc_prefix'); |
|
51 | 51 | |
52 | - if( function_exists( 'apc_store' ) === true && $apc === true ) { |
|
53 | - $conf = new \Aimeos\MW\Config\Decorator\APC( $conf, $prefix ); |
|
52 | + if (function_exists('apc_store') === true && $apc === true) { |
|
53 | + $conf = new \Aimeos\MW\Config\Decorator\APC($conf, $prefix); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $local = array( |
57 | - 'admin' => $this->container->getParameter( 'aimeos_shop.admin' ), |
|
58 | - 'client' => $this->container->getParameter( 'aimeos_shop.client' ), |
|
59 | - 'controller' => $this->container->getParameter( 'aimeos_shop.controller' ), |
|
60 | - 'madmin' => $this->container->getParameter( 'aimeos_shop.madmin' ), |
|
61 | - 'mshop' => $this->container->getParameter( 'aimeos_shop.mshop' ), |
|
62 | - 'resource' => $this->container->getParameter( 'aimeos_shop.resource' ), |
|
57 | + 'admin' => $this->container->getParameter('aimeos_shop.admin'), |
|
58 | + 'client' => $this->container->getParameter('aimeos_shop.client'), |
|
59 | + 'controller' => $this->container->getParameter('aimeos_shop.controller'), |
|
60 | + 'madmin' => $this->container->getParameter('aimeos_shop.madmin'), |
|
61 | + 'mshop' => $this->container->getParameter('aimeos_shop.mshop'), |
|
62 | + 'resource' => $this->container->getParameter('aimeos_shop.resource'), |
|
63 | 63 | ); |
64 | 64 | |
65 | - $config = new \Aimeos\MW\Config\Decorator\Memory( $conf, $local ); |
|
66 | - $settings = $this->container->getParameter( 'aimeos_shop.' . $type ); |
|
65 | + $config = new \Aimeos\MW\Config\Decorator\Memory($conf, $local); |
|
66 | + $settings = $this->container->getParameter('aimeos_shop.'.$type); |
|
67 | 67 | |
68 | - if( $settings !== array() ) { |
|
69 | - $config = new \Aimeos\MW\Config\Decorator\Memory( $config, $settings ); |
|
68 | + if ($settings !== array()) { |
|
69 | + $config = new \Aimeos\MW\Config\Decorator\Memory($config, $settings); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | return $config; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param RequestStack $requestStack Current request stack |
35 | 35 | * @param Container $container Container object to access parameters |
36 | 36 | */ |
37 | - public function __construct( RequestStack $requestStack, Container $container ) |
|
37 | + public function __construct(RequestStack $requestStack, Container $container) |
|
38 | 38 | { |
39 | 39 | $this->requestStack = $requestStack; |
40 | 40 | $this->container = $container; |
@@ -48,54 +48,54 @@ discard block |
||
48 | 48 | * @param string $type Configuration type ("frontend" or "backend") |
49 | 49 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
50 | 50 | */ |
51 | - public function get( $locale = true, $type = 'frontend' ) |
|
51 | + public function get($locale = true, $type = 'frontend') |
|
52 | 52 | { |
53 | 53 | $container = $this->container; |
54 | - $config = $container->get( 'aimeos_config' )->get( $type ); |
|
54 | + $config = $container->get('aimeos_config')->get($type); |
|
55 | 55 | |
56 | - if( self::$context === null ) |
|
56 | + if (self::$context === null) |
|
57 | 57 | { |
58 | 58 | $context = new \Aimeos\MShop\Context\Item\Standard(); |
59 | 59 | |
60 | - $context->setConfig( $config ); |
|
60 | + $context->setConfig($config); |
|
61 | 61 | |
62 | - $dbm = new \Aimeos\MW\DB\Manager\DBAL( $config ); |
|
63 | - $context->setDatabaseManager( $dbm ); |
|
62 | + $dbm = new \Aimeos\MW\DB\Manager\DBAL($config); |
|
63 | + $context->setDatabaseManager($dbm); |
|
64 | 64 | |
65 | - $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $config ); |
|
66 | - $context->setFilesystemManager( $fs ); |
|
65 | + $fs = new \Aimeos\MW\Filesystem\Manager\Standard($config); |
|
66 | + $context->setFilesystemManager($fs); |
|
67 | 67 | |
68 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $config ); |
|
69 | - $context->setMessageQueueManager( $mq ); |
|
68 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($config); |
|
69 | + $context->setMessageQueueManager($mq); |
|
70 | 70 | |
71 | - $mail = new \Aimeos\MW\Mail\Swift( function() use ( $container) { return $container->get( 'mailer' ); } ); |
|
72 | - $context->setMail( $mail ); |
|
71 | + $mail = new \Aimeos\MW\Mail\Swift(function() use ($container) { return $container->get('mailer'); } ); |
|
72 | + $context->setMail($mail); |
|
73 | 73 | |
74 | - $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context ); |
|
75 | - $context->setLogger( $logger ); |
|
74 | + $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context); |
|
75 | + $context->setLogger($logger); |
|
76 | 76 | |
77 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context ); |
|
78 | - $context->setCache( $cache ); |
|
77 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); |
|
78 | + $context->setCache($cache); |
|
79 | 79 | |
80 | 80 | self::$context = $context; |
81 | 81 | } |
82 | 82 | |
83 | 83 | $context = self::$context; |
84 | - $context->setConfig( $config ); |
|
84 | + $context->setConfig($config); |
|
85 | 85 | |
86 | - if( $locale === true ) |
|
86 | + if ($locale === true) |
|
87 | 87 | { |
88 | - $localeItem = $this->getLocale( $context ); |
|
88 | + $localeItem = $this->getLocale($context); |
|
89 | 89 | $langid = $localeItem->getLanguageId(); |
90 | 90 | |
91 | - $context->setLocale( $localeItem ); |
|
92 | - $context->setI18n( $this->container->get('aimeos_i18n')->get( array( $langid ) ) ); |
|
91 | + $context->setLocale($localeItem); |
|
92 | + $context->setI18n($this->container->get('aimeos_i18n')->get(array($langid))); |
|
93 | 93 | } |
94 | 94 | |
95 | - $session = new \Aimeos\MW\Session\Symfony2( $this->container->get( 'session' ) ); |
|
96 | - $context->setSession( $session ); |
|
95 | + $session = new \Aimeos\MW\Session\Symfony2($this->container->get('session')); |
|
96 | + $context->setSession($session); |
|
97 | 97 | |
98 | - $this->addUser( $context ); |
|
98 | + $this->addUser($context); |
|
99 | 99 | |
100 | 100 | return $context; |
101 | 101 | } |
@@ -106,39 +106,39 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
108 | 108 | */ |
109 | - protected function addUser( \Aimeos\MShop\Context\Item\Iface $context ) |
|
109 | + protected function addUser(\Aimeos\MShop\Context\Item\Iface $context) |
|
110 | 110 | { |
111 | 111 | $token = null; |
112 | 112 | $username = ''; |
113 | 113 | |
114 | - if( $this->container->has( 'security.token_storage' ) ) { |
|
115 | - $token = $this->container->get( 'security.token_storage' )->getToken(); |
|
114 | + if ($this->container->has('security.token_storage')) { |
|
115 | + $token = $this->container->get('security.token_storage')->getToken(); |
|
116 | 116 | } |
117 | - else if( $this->container->has( 'security.context' ) ) { |
|
118 | - $token = $this->container->get( 'security.context' )->getToken(); |
|
117 | + else if ($this->container->has('security.context')) { |
|
118 | + $token = $this->container->get('security.context')->getToken(); |
|
119 | 119 | } |
120 | 120 | |
121 | - if( is_object( $token ) ) |
|
121 | + if (is_object($token)) |
|
122 | 122 | { |
123 | - if( method_exists( $token->getUser(), 'getId' ) ) |
|
123 | + if (method_exists($token->getUser(), 'getId')) |
|
124 | 124 | { |
125 | 125 | $userid = $token->getUser()->getId(); |
126 | - $context->setUserId( $userid ); |
|
127 | - $context->setGroupIds( function() use ( $context, $userid ) |
|
126 | + $context->setUserId($userid); |
|
127 | + $context->setGroupIds(function() use ($context, $userid) |
|
128 | 128 | { |
129 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
130 | - return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups(); |
|
129 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
130 | + return $manager->getItem($userid, array('customer/group'))->getGroups(); |
|
131 | 131 | } ); |
132 | 132 | } |
133 | 133 | |
134 | - if( is_object( $token->getUser() ) ) { |
|
135 | - $username = $token->getUser()->getUsername(); |
|
134 | + if (is_object($token->getUser())) { |
|
135 | + $username = $token->getUser()->getUsername(); |
|
136 | 136 | } else { |
137 | 137 | $username = $token->getUser(); |
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - $context->setEditor( $username ); |
|
141 | + $context->setEditor($username); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
@@ -148,19 +148,19 @@ discard block |
||
148 | 148 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
149 | 149 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
150 | 150 | */ |
151 | - protected function getLocale( \Aimeos\MShop\Context\Item\Iface $context ) |
|
151 | + protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context) |
|
152 | 152 | { |
153 | - if( $this->locale === null ) |
|
153 | + if ($this->locale === null) |
|
154 | 154 | { |
155 | - $status = $this->container->getParameter( 'aimeos_shop.disable_sites' ); |
|
155 | + $status = $this->container->getParameter('aimeos_shop.disable_sites'); |
|
156 | 156 | $request = $this->requestStack->getMasterRequest(); |
157 | 157 | |
158 | - $site = $request->attributes->get( 'site', $request->query->get( 'site', 'default' ) ); |
|
159 | - $currency = $request->attributes->get( 'currency', $request->query->get( 'currency', '' ) ); |
|
160 | - $lang = $request->attributes->get( 'locale', $request->query->get( 'locale', '' ) ); |
|
158 | + $site = $request->attributes->get('site', $request->query->get('site', 'default')); |
|
159 | + $currency = $request->attributes->get('currency', $request->query->get('currency', '')); |
|
160 | + $lang = $request->attributes->get('locale', $request->query->get('locale', '')); |
|
161 | 161 | |
162 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
163 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $status ); |
|
162 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
163 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $status); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | return $this->locale; |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | protected function configure() |
30 | 30 | { |
31 | 31 | $names = ''; |
32 | - $aimeos = new \Aimeos\Bootstrap( array() ); |
|
33 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/jobs' ); |
|
34 | - $controllers = \Aimeos\Controller\Jobs\Factory::getControllers( $this->getBareContext(), $aimeos, $cntlPaths ); |
|
32 | + $aimeos = new \Aimeos\Bootstrap(array()); |
|
33 | + $cntlPaths = $aimeos->getCustomPaths('controller/jobs'); |
|
34 | + $controllers = \Aimeos\Controller\Jobs\Factory::getControllers($this->getBareContext(), $aimeos, $cntlPaths); |
|
35 | 35 | |
36 | - foreach( $controllers as $key => $controller ) { |
|
37 | - $names .= str_pad( $key, 30 ) . $controller->getName() . PHP_EOL; |
|
36 | + foreach ($controllers as $key => $controller) { |
|
37 | + $names .= str_pad($key, 30).$controller->getName().PHP_EOL; |
|
38 | 38 | } |
39 | 39 | |
40 | - $this->setName( 'aimeos:jobs' ); |
|
41 | - $this->setDescription( 'Executes the job controllers' ); |
|
42 | - $this->addArgument( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' ); |
|
43 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' ); |
|
44 | - $this->setHelp( "Available jobs are:\n" . $names ); |
|
40 | + $this->setName('aimeos:jobs'); |
|
41 | + $this->setDescription('Executes the job controllers'); |
|
42 | + $this->addArgument('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"'); |
|
43 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)'); |
|
44 | + $this->setHelp("Available jobs are:\n".$names); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -51,23 +51,23 @@ discard block |
||
51 | 51 | * @param InputInterface $input Input object |
52 | 52 | * @param OutputInterface $output Output object |
53 | 53 | */ |
54 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
54 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
55 | 55 | { |
56 | 56 | $context = $this->getContext(); |
57 | - $aimeos = $this->getContainer()->get( 'aimeos' )->get(); |
|
57 | + $aimeos = $this->getContainer()->get('aimeos')->get(); |
|
58 | 58 | |
59 | - $jobs = explode( ' ', $input->getArgument( 'jobs' ) ); |
|
60 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
59 | + $jobs = explode(' ', $input->getArgument('jobs')); |
|
60 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
61 | 61 | |
62 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
62 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
63 | 63 | { |
64 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), 'en', '', false ); |
|
65 | - $context->setLocale( $localeItem ); |
|
64 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false); |
|
65 | + $context->setLocale($localeItem); |
|
66 | 66 | |
67 | - $output->writeln( sprintf( 'Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode() ) ); |
|
67 | + $output->writeln(sprintf('Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode())); |
|
68 | 68 | |
69 | - foreach( $jobs as $jobname ) { |
|
70 | - \Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run(); |
|
69 | + foreach ($jobs as $jobname) { |
|
70 | + \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run(); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | { |
83 | 83 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
84 | 84 | |
85 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), array() ); |
|
86 | - $ctx->setConfig( $conf ); |
|
85 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), array()); |
|
86 | + $ctx->setConfig($conf); |
|
87 | 87 | |
88 | - $locale = \Aimeos\MShop\Factory::createManager( $ctx, 'locale' )->createItem(); |
|
89 | - $locale->setLanguageId( 'en' ); |
|
90 | - $ctx->setLocale( $locale ); |
|
88 | + $locale = \Aimeos\MShop\Factory::createManager($ctx, 'locale')->createItem(); |
|
89 | + $locale->setLanguageId('en'); |
|
90 | + $ctx->setLocale($locale); |
|
91 | 91 | |
92 | - $i18n = new \Aimeos\MW\Translation\None( 'en' ); |
|
93 | - $ctx->setI18n( array( 'en' => $i18n ) ); |
|
92 | + $i18n = new \Aimeos\MW\Translation\None('en'); |
|
93 | + $ctx->setI18n(array('en' => $i18n)); |
|
94 | 94 | |
95 | 95 | return $ctx; |
96 | 96 | } |
@@ -105,19 +105,19 @@ discard block |
||
105 | 105 | { |
106 | 106 | $container = $this->getContainer(); |
107 | 107 | $aimeos = $container->get('aimeos')->get(); |
108 | - $context = $container->get( 'aimeos_context' )->get( false, 'backend' ); |
|
108 | + $context = $container->get('aimeos_context')->get(false, 'backend'); |
|
109 | 109 | |
110 | - $tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' ); |
|
111 | - $tmplPaths = array_merge( $tmplPaths, $aimeos->getCustomPaths( 'client/html/templates' ) ); |
|
112 | - $view = $container->get('aimeos_view')->create( $context, $tmplPaths ); |
|
110 | + $tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates'); |
|
111 | + $tmplPaths = array_merge($tmplPaths, $aimeos->getCustomPaths('client/html/templates')); |
|
112 | + $view = $container->get('aimeos_view')->create($context, $tmplPaths); |
|
113 | 113 | |
114 | - $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' ); |
|
115 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
116 | - $i18n = $this->getContainer()->get( 'aimeos_i18n' )->get( $langids ); |
|
114 | + $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language'); |
|
115 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
116 | + $i18n = $this->getContainer()->get('aimeos_i18n')->get($langids); |
|
117 | 117 | |
118 | - $context->setEditor( 'aimeos:jobs' ); |
|
119 | - $context->setView( $view ); |
|
120 | - $context->setI18n( $i18n ); |
|
118 | + $context->setEditor('aimeos:jobs'); |
|
119 | + $context->setView($view); |
|
120 | + $context->setI18n($i18n); |
|
121 | 121 | |
122 | 122 | return $context; |
123 | 123 | } |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | */ |
30 | 30 | protected function configure() |
31 | 31 | { |
32 | - $this->setName( 'aimeos:account'); |
|
33 | - $this->setDescription( 'Creates new (admin) accounts' ); |
|
34 | - $this->addArgument( 'email', InputArgument::REQUIRED, 'E-mail address of the account that should be created' ); |
|
35 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)' ); |
|
36 | - $this->addOption( 'password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)' ); |
|
37 | - $this->addOption( 'admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges' ); |
|
38 | - $this->addOption( 'editor', null, InputOption::VALUE_NONE, 'If account should have limited editor privileges' ); |
|
32 | + $this->setName('aimeos:account'); |
|
33 | + $this->setDescription('Creates new (admin) accounts'); |
|
34 | + $this->addArgument('email', InputArgument::REQUIRED, 'E-mail address of the account that should be created'); |
|
35 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)'); |
|
36 | + $this->addOption('password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)'); |
|
37 | + $this->addOption('admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges'); |
|
38 | + $this->addOption('editor', null, InputOption::VALUE_NONE, 'If account should have limited editor privileges'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -45,32 +45,32 @@ discard block |
||
45 | 45 | * @param InputInterface $input Input object |
46 | 46 | * @param OutputInterface $output Output object |
47 | 47 | */ |
48 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
48 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
49 | 49 | { |
50 | - $code = $input->getArgument( 'email' ); |
|
51 | - if( ( $password = $input->getOption( 'password' ) ) === null ) |
|
50 | + $code = $input->getArgument('email'); |
|
51 | + if (($password = $input->getOption('password')) === null) |
|
52 | 52 | { |
53 | - $helper = $this->getHelper( 'question' ); |
|
54 | - $question = new Question( 'Password' ); |
|
55 | - $question->setHidden( true ); |
|
53 | + $helper = $this->getHelper('question'); |
|
54 | + $question = new Question('Password'); |
|
55 | + $question->setHidden(true); |
|
56 | 56 | |
57 | - $password = $helper->ask( $input, $output, $question ); |
|
57 | + $password = $helper->ask($input, $output, $question); |
|
58 | 58 | } |
59 | 59 | |
60 | - $context = $this->getContainer()->get( 'aimeos_context' )->get( false, 'backend' ); |
|
61 | - $context->setEditor( 'aimeos:account' ); |
|
60 | + $context = $this->getContainer()->get('aimeos_context')->get(false, 'backend'); |
|
61 | + $context->setEditor('aimeos:account'); |
|
62 | 62 | |
63 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
64 | - $context->setLocale( $localeManager->createItem() ); |
|
63 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
64 | + $context->setLocale($localeManager->createItem()); |
|
65 | 65 | |
66 | - $user = $this->createCustomerItem( $context, $code, $password ); |
|
66 | + $user = $this->createCustomerItem($context, $code, $password); |
|
67 | 67 | |
68 | - if( $input->getOption( 'admin' ) ) { |
|
69 | - $this->addGroup( $input, $output, $context, $user, 'admin' ); |
|
68 | + if ($input->getOption('admin')) { |
|
69 | + $this->addGroup($input, $output, $context, $user, 'admin'); |
|
70 | 70 | } |
71 | 71 | |
72 | - if( $input->getOption( 'editor' ) ) { |
|
73 | - $this->addGroup( $input, $output, $context, $user, 'editor' ); |
|
72 | + if ($input->getOption('editor')) { |
|
73 | + $this->addGroup($input, $output, $context, $user, 'editor'); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -84,24 +84,24 @@ discard block |
||
84 | 84 | * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object |
85 | 85 | * @param string $group Unique customer group code |
86 | 86 | */ |
87 | - protected function addGroup( InputInterface $input, OutputInterface $output, |
|
88 | - \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group ) |
|
87 | + protected function addGroup(InputInterface $input, OutputInterface $output, |
|
88 | + \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group) |
|
89 | 89 | { |
90 | - $output->writeln( sprintf( 'Add "%1$s" group to user "%2$s" for sites', $group, $user->getCode() ) ); |
|
90 | + $output->writeln(sprintf('Add "%1$s" group to user "%2$s" for sites', $group, $user->getCode())); |
|
91 | 91 | |
92 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
92 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
93 | 93 | |
94 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
94 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
95 | 95 | { |
96 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
96 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
97 | 97 | |
98 | 98 | $lcontext = clone $context; |
99 | - $lcontext->setLocale( $localeItem ); |
|
99 | + $lcontext->setLocale($localeItem); |
|
100 | 100 | |
101 | - $output->writeln( '- ' . $siteItem->getCode() ); |
|
101 | + $output->writeln('- '.$siteItem->getCode()); |
|
102 | 102 | |
103 | - $groupItem = $this->getGroupItem( $lcontext, $group ); |
|
104 | - $this->addListItem( $lcontext, $user->getId(), $groupItem->getId() ); |
|
103 | + $groupItem = $this->getGroupItem($lcontext, $group); |
|
104 | + $this->addListItem($lcontext, $user->getId(), $groupItem->getId()); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -113,31 +113,31 @@ discard block |
||
113 | 113 | * @param string $userid Unique user ID |
114 | 114 | * @param string $groupid Unique group ID |
115 | 115 | */ |
116 | - protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid ) |
|
116 | + protected function addListItem(\Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid) |
|
117 | 117 | { |
118 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'lists' ); |
|
119 | - $typeid = $manager->getSubmanager( 'type' )->findItem( 'default', array(), 'customer/group' )->getId(); |
|
118 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('lists'); |
|
119 | + $typeid = $manager->getSubmanager('type')->findItem('default', array(), 'customer/group')->getId(); |
|
120 | 120 | |
121 | 121 | $search = $manager->createSearch(); |
122 | 122 | $expr = array( |
123 | - $search->compare( '==', 'customer.lists.parentid', $userid ), |
|
124 | - $search->compare( '==', 'customer.lists.refid', $groupid ), |
|
125 | - $search->compare( '==', 'customer.lists.domain', 'customer/group' ), |
|
126 | - $search->compare( '==', 'customer.lists.typeid', $typeid ), |
|
123 | + $search->compare('==', 'customer.lists.parentid', $userid), |
|
124 | + $search->compare('==', 'customer.lists.refid', $groupid), |
|
125 | + $search->compare('==', 'customer.lists.domain', 'customer/group'), |
|
126 | + $search->compare('==', 'customer.lists.typeid', $typeid), |
|
127 | 127 | ); |
128 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
129 | - $search->setSlice( 0, 1 ); |
|
128 | + $search->setConditions($search->combine('&&', $expr)); |
|
129 | + $search->setSlice(0, 1); |
|
130 | 130 | |
131 | - if( count( $manager->searchItems( $search ) ) === 0 ) |
|
131 | + if (count($manager->searchItems($search)) === 0) |
|
132 | 132 | { |
133 | 133 | $item = $manager->createItem(); |
134 | - $item->setDomain( 'customer/group' ); |
|
135 | - $item->setParentId( $userid ); |
|
136 | - $item->setTypeId( $typeid ); |
|
137 | - $item->setRefId( $groupid ); |
|
138 | - $item->setStatus( 1 ); |
|
134 | + $item->setDomain('customer/group'); |
|
135 | + $item->setParentId($userid); |
|
136 | + $item->setTypeId($typeid); |
|
137 | + $item->setRefId($groupid); |
|
138 | + $item->setStatus(1); |
|
139 | 139 | |
140 | - $manager->saveItem( $item, false ); |
|
140 | + $manager->saveItem($item, false); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
@@ -152,22 +152,22 @@ discard block |
||
152 | 152 | * @param string $password New user password |
153 | 153 | * @return \Aimeos\MShop\Customer\Item\Iface Aimeos customer item object |
154 | 154 | */ |
155 | - protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password ) |
|
155 | + protected function createCustomerItem(\Aimeos\MShop\Context\Item\Iface $context, $email, $password) |
|
156 | 156 | { |
157 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
157 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
158 | 158 | |
159 | 159 | try { |
160 | - $item = $manager->findItem( $email ); |
|
161 | - } catch( \Aimeos\MShop\Exception $e ) { |
|
160 | + $item = $manager->findItem($email); |
|
161 | + } catch (\Aimeos\MShop\Exception $e) { |
|
162 | 162 | $item = $manager->createItem(); |
163 | 163 | } |
164 | 164 | |
165 | - $item->setCode( $email ); |
|
166 | - $item->setLabel( $email ); |
|
167 | - $item->getPaymentAddress()->setEmail( $email ); |
|
168 | - $item->setPassword( $password ); |
|
165 | + $item->setCode($email); |
|
166 | + $item->setLabel($email); |
|
167 | + $item->getPaymentAddress()->setEmail($email); |
|
168 | + $item->setPassword($password); |
|
169 | 169 | |
170 | - $manager->saveItem( $item ); |
|
170 | + $manager->saveItem($item); |
|
171 | 171 | |
172 | 172 | return $item; |
173 | 173 | } |
@@ -180,21 +180,21 @@ discard block |
||
180 | 180 | * @param string $code Unique customer group code |
181 | 181 | * @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object |
182 | 182 | */ |
183 | - protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code ) |
|
183 | + protected function getGroupItem(\Aimeos\MShop\Context\Item\Iface $context, $code) |
|
184 | 184 | { |
185 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'group' ); |
|
185 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('group'); |
|
186 | 186 | |
187 | 187 | try |
188 | 188 | { |
189 | - $item = $manager->findItem( $code ); |
|
189 | + $item = $manager->findItem($code); |
|
190 | 190 | } |
191 | - catch( \Aimeos\MShop\Exception $e ) |
|
191 | + catch (\Aimeos\MShop\Exception $e) |
|
192 | 192 | { |
193 | 193 | $item = $manager->createItem(); |
194 | - $item->setLabel( $code ); |
|
195 | - $item->setCode( $code ); |
|
194 | + $item->setLabel($code); |
|
195 | + $item->setCode($code); |
|
196 | 196 | |
197 | - $manager->saveItem( $item ); |
|
197 | + $manager->saveItem($item); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | return $item; |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | */ |
29 | 29 | protected function configure() |
30 | 30 | { |
31 | - $this->setName( 'aimeos:cache' ); |
|
32 | - $this->setDescription( 'Clears the content cache' ); |
|
33 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)' ); |
|
31 | + $this->setName('aimeos:cache'); |
|
32 | + $this->setDescription('Clears the content cache'); |
|
33 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -40,26 +40,26 @@ discard block |
||
40 | 40 | * @param InputInterface $input Input object |
41 | 41 | * @param OutputInterface $output Output object |
42 | 42 | */ |
43 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
43 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
44 | 44 | { |
45 | - $context = $this->getContainer()->get( 'aimeos_context' )->get( false, 'backend' ); |
|
46 | - $context->setEditor( 'aimeos:cache' ); |
|
45 | + $context = $this->getContainer()->get('aimeos_context')->get(false, 'backend'); |
|
46 | + $context->setEditor('aimeos:cache'); |
|
47 | 47 | |
48 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
48 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
49 | 49 | |
50 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
50 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
51 | 51 | { |
52 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
52 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
53 | 53 | |
54 | 54 | $lcontext = clone $context; |
55 | - $lcontext->setLocale( $localeItem ); |
|
55 | + $lcontext->setLocale($localeItem); |
|
56 | 56 | |
57 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext ); |
|
58 | - $lcontext->setCache( $cache ); |
|
57 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext); |
|
58 | + $lcontext->setCache($cache); |
|
59 | 59 | |
60 | - $output->writeln( sprintf( 'Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode() ) ); |
|
60 | + $output->writeln(sprintf('Clearing the Aimeos cache for site <info>%1$s</info>', $siteItem->getCode())); |
|
61 | 61 | |
62 | - \Aimeos\MAdmin\Cache\Manager\Factory::createManager( $lcontext )->getCache()->flush(); |
|
62 | + \Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->flush(); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | } |