@@ -365,8 +365,8 @@ |
||
365 | 365 | * @throws PropelException Any exceptions caught during processing will be |
366 | 366 | * rethrown wrapped into a PropelException. |
367 | 367 | */ |
368 | - public static function doDelete($values, ConnectionInterface $con = null) |
|
369 | - { |
|
368 | + public static function doDelete($values, ConnectionInterface $con = null) |
|
369 | + { |
|
370 | 370 | if (null === $con) { |
371 | 371 | $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
372 | 372 | } |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | * first dimension keys are the type constants |
103 | 103 | * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
104 | 104 | */ |
105 | - protected static $fieldNames = array ( |
|
106 | - self::TYPE_PHPNAME => array('Id', 'Name', 'Datecreate', 'Desc', ), |
|
107 | - self::TYPE_CAMELNAME => array('id', 'name', 'datecreate', 'desc', ), |
|
108 | - self::TYPE_COLNAME => array(SelfpriceTableMap::COL_ID, SelfpriceTableMap::COL_NAME, SelfpriceTableMap::COL_DATECREATE, SelfpriceTableMap::COL_DESC, ), |
|
109 | - self::TYPE_FIELDNAME => array('id', 'name', 'datecreate', 'desc', ), |
|
110 | - self::TYPE_NUM => array(0, 1, 2, 3, ) |
|
105 | + protected static $fieldNames = array( |
|
106 | + self::TYPE_PHPNAME => array('Id', 'Name', 'Datecreate', 'Desc',), |
|
107 | + self::TYPE_CAMELNAME => array('id', 'name', 'datecreate', 'desc',), |
|
108 | + self::TYPE_COLNAME => array(SelfpriceTableMap::COL_ID, SelfpriceTableMap::COL_NAME, SelfpriceTableMap::COL_DATECREATE, SelfpriceTableMap::COL_DESC,), |
|
109 | + self::TYPE_FIELDNAME => array('id', 'name', 'datecreate', 'desc',), |
|
110 | + self::TYPE_NUM => array(0, 1, 2, 3,) |
|
111 | 111 | ); |
112 | 112 | |
113 | 113 | /** |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | * first dimension keys are the type constants |
117 | 117 | * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
118 | 118 | */ |
119 | - protected static $fieldKeys = array ( |
|
120 | - self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Datecreate' => 2, 'Desc' => 3, ), |
|
121 | - self::TYPE_CAMELNAME => array('id' => 0, 'name' => 1, 'datecreate' => 2, 'desc' => 3, ), |
|
122 | - self::TYPE_COLNAME => array(SelfpriceTableMap::COL_ID => 0, SelfpriceTableMap::COL_NAME => 1, SelfpriceTableMap::COL_DATECREATE => 2, SelfpriceTableMap::COL_DESC => 3, ), |
|
123 | - self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'datecreate' => 2, 'desc' => 3, ), |
|
124 | - self::TYPE_NUM => array(0, 1, 2, 3, ) |
|
119 | + protected static $fieldKeys = array( |
|
120 | + self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Datecreate' => 2, 'Desc' => 3,), |
|
121 | + self::TYPE_CAMELNAME => array('id' => 0, 'name' => 1, 'datecreate' => 2, 'desc' => 3,), |
|
122 | + self::TYPE_COLNAME => array(SelfpriceTableMap::COL_ID => 0, SelfpriceTableMap::COL_NAME => 1, SelfpriceTableMap::COL_DATECREATE => 2, SelfpriceTableMap::COL_DESC => 3,), |
|
123 | + self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'datecreate' => 2, 'desc' => 3,), |
|
124 | + self::TYPE_NUM => array(0, 1, 2, 3,) |
|
125 | 125 | ); |
126 | 126 | |
127 | 127 | /** |
@@ -403,8 +403,8 @@ discard block |
||
403 | 403 | $criteria = $criteria->buildCriteria(); // build Criteria from Selfprice object |
404 | 404 | } |
405 | 405 | |
406 | - if ($criteria->containsKey(SelfpriceTableMap::COL_ID) && $criteria->keyContainsValue(SelfpriceTableMap::COL_ID) ) { |
|
407 | - throw new PropelException('Cannot insert a value for auto-increment primary key ('.SelfpriceTableMap::COL_ID.')'); |
|
406 | + if ($criteria->containsKey(SelfpriceTableMap::COL_ID) && $criteria->keyContainsValue(SelfpriceTableMap::COL_ID)) { |
|
407 | + throw new PropelException('Cannot insert a value for auto-increment primary key (' . SelfpriceTableMap::COL_ID . ')'); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | |
414 | 414 | // use transaction because $criteria could contain info |
415 | 415 | // for more than one table (I guess, conceivably) |
416 | - return $con->transaction(function () use ($con, $query) { |
|
416 | + return $con->transaction(function() use ($con, $query) { |
|
417 | 417 | return $query->doInsert($con); |
418 | 418 | }); |
419 | 419 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function getUpSQL() |
39 | 39 | { |
40 | 40 | return array ( |
41 | - 'default' => ' |
|
41 | + 'default' => ' |
|
42 | 42 | # This is a fix for InnoDB in MySQL >= 4.1.x |
43 | 43 | # It "suspends judgement" for fkey relationships until are tables are set. |
44 | 44 | SET FOREIGN_KEY_CHECKS = 0; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function getDownSQL() |
69 | 69 | { |
70 | 70 | return array ( |
71 | - 'default' => ' |
|
71 | + 'default' => ' |
|
72 | 72 | # This is a fix for InnoDB in MySQL >= 4.1.x |
73 | 73 | # It "suspends judgement" for fkey relationships until are tables are set. |
74 | 74 | SET FOREIGN_KEY_CHECKS = 0; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function getUpSQL() |
39 | 39 | { |
40 | - return array ( |
|
40 | + return array( |
|
41 | 41 | 'default' => ' |
42 | 42 | # This is a fix for InnoDB in MySQL >= 4.1.x |
43 | 43 | # It "suspends judgement" for fkey relationships until are tables are set. |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function getDownSQL() |
69 | 69 | { |
70 | - return array ( |
|
70 | + return array( |
|
71 | 71 | 'default' => ' |
72 | 72 | # This is a fix for InnoDB in MySQL >= 4.1.x |
73 | 73 | # It "suspends judgement" for fkey relationships until are tables are set. |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function getUpSQL() |
39 | 39 | { |
40 | 40 | return array ( |
41 | - 'default' => ' |
|
41 | + 'default' => ' |
|
42 | 42 | # This is a fix for InnoDB in MySQL >= 4.1.x |
43 | 43 | # It "suspends judgement" for fkey relationships until are tables are set. |
44 | 44 | SET FOREIGN_KEY_CHECKS = 0; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function getDownSQL() |
69 | 69 | { |
70 | 70 | return array ( |
71 | - 'default' => ' |
|
71 | + 'default' => ' |
|
72 | 72 | # This is a fix for InnoDB in MySQL >= 4.1.x |
73 | 73 | # It "suspends judgement" for fkey relationships until are tables are set. |
74 | 74 | SET FOREIGN_KEY_CHECKS = 0; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function getUpSQL() |
39 | 39 | { |
40 | - return array ( |
|
40 | + return array( |
|
41 | 41 | 'default' => ' |
42 | 42 | # This is a fix for InnoDB in MySQL >= 4.1.x |
43 | 43 | # It "suspends judgement" for fkey relationships until are tables are set. |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function getDownSQL() |
69 | 69 | { |
70 | - return array ( |
|
70 | + return array( |
|
71 | 71 | 'default' => ' |
72 | 72 | # This is a fix for InnoDB in MySQL >= 4.1.x |
73 | 73 | # It "suspends judgement" for fkey relationships until are tables are set. |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Core\Modules\UserList; |
3 | 3 | |
4 | -use Frameworkless\Controllers; |
|
5 | -use Donquixote\Cellbrush\Table\Table; |
|
4 | +use Frameworkless\Controllers; |
|
5 | +use Donquixote\Cellbrush\Table\Table; |
|
6 | 6 | use Symfony\Component\HttpFoundation\Request; |
7 | 7 | |
8 | 8 | /** |
@@ -27,66 +27,66 @@ |
||
27 | 27 | protected $limit = 5; |
28 | 28 | |
29 | 29 | function __construct(\Core\Models\User\UserRepository $userRepository, Request $request){ |
30 | - $this->userRepository = $userRepository; |
|
31 | - $this->request = $request; |
|
30 | + $this->userRepository = $userRepository; |
|
31 | + $this->request = $request; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public function process(){ |
35 | 35 | |
36 | - if($this->request->query->get('fn') == 'add'){ |
|
37 | - $this->add(); |
|
38 | - } |
|
39 | - |
|
40 | - $Users = $this->userRepository->findMany([], $this->limit); |
|
41 | - |
|
42 | - $table = Table::create(); |
|
43 | - $table->addColNames([0, 1, 2, 3]); |
|
44 | - $table->addClass('table table-striped'); |
|
45 | - $table->thead() |
|
46 | - ->addRowName('head row') |
|
47 | - ->th('head row', 0, 'Id') |
|
48 | - ->th('head row', 1, 'Регистрация') |
|
49 | - ->th('head row', 2, 'Имя') |
|
50 | - ->th('head row', 3, 'Email'); |
|
51 | - $i = 0; |
|
52 | - foreach($Users as $User){ |
|
53 | - $table->addRow($i)->tdMultiple([ |
|
54 | - $User->getId(), |
|
55 | - $User->getCreatedAt("d.m.Y"), |
|
56 | - $User->getName(), |
|
57 | - $User->getEmail()]); |
|
58 | - $i++; |
|
59 | - } |
|
60 | - |
|
61 | - return $this->render('default', [ |
|
62 | - 'table' => $table->render() |
|
63 | - ]); |
|
36 | + if($this->request->query->get('fn') == 'add'){ |
|
37 | + $this->add(); |
|
38 | + } |
|
39 | + |
|
40 | + $Users = $this->userRepository->findMany([], $this->limit); |
|
41 | + |
|
42 | + $table = Table::create(); |
|
43 | + $table->addColNames([0, 1, 2, 3]); |
|
44 | + $table->addClass('table table-striped'); |
|
45 | + $table->thead() |
|
46 | + ->addRowName('head row') |
|
47 | + ->th('head row', 0, 'Id') |
|
48 | + ->th('head row', 1, 'Регистрация') |
|
49 | + ->th('head row', 2, 'Имя') |
|
50 | + ->th('head row', 3, 'Email'); |
|
51 | + $i = 0; |
|
52 | + foreach($Users as $User){ |
|
53 | + $table->addRow($i)->tdMultiple([ |
|
54 | + $User->getId(), |
|
55 | + $User->getCreatedAt("d.m.Y"), |
|
56 | + $User->getName(), |
|
57 | + $User->getEmail()]); |
|
58 | + $i++; |
|
59 | + } |
|
60 | + |
|
61 | + return $this->render('default', [ |
|
62 | + 'table' => $table->render() |
|
63 | + ]); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | protected function add(){ |
67 | 67 | |
68 | - try{ |
|
68 | + try{ |
|
69 | 69 | |
70 | - $User = $this->userRepository->build(); |
|
71 | - $User->setEmail('[email protected]'); |
|
70 | + $User = $this->userRepository->build(); |
|
71 | + $User->setEmail('[email protected]'); |
|
72 | 72 | |
73 | - if(!$this->userRepository->save($User)){ |
|
74 | - throw new Exception('User not save'); |
|
75 | - } else{ |
|
76 | - $this->logger->info("Пользователь успешно сохранен!"); |
|
77 | - } |
|
78 | - } catch(\Frameworkless\Exceptions\ValidationException $ex){ |
|
73 | + if(!$this->userRepository->save($User)){ |
|
74 | + throw new Exception('User not save'); |
|
75 | + } else{ |
|
76 | + $this->logger->info("Пользователь успешно сохранен!"); |
|
77 | + } |
|
78 | + } catch(\Frameworkless\Exceptions\ValidationException $ex){ |
|
79 | 79 | |
80 | - foreach($ex->getFailures() as $failure){ |
|
81 | - $this->logger->error("Property " . $failure->getPropertyPath() . ": " . $failure->getMessage() . "\n"); |
|
82 | - } |
|
80 | + foreach($ex->getFailures() as $failure){ |
|
81 | + $this->logger->error("Property " . $failure->getPropertyPath() . ": " . $failure->getMessage() . "\n"); |
|
82 | + } |
|
83 | 83 | |
84 | - $this->logger->info("Произошла ошибка при сохранении пользователя"); |
|
85 | - } catch(\Exception $ex){ |
|
84 | + $this->logger->info("Произошла ошибка при сохранении пользователя"); |
|
85 | + } catch(\Exception $ex){ |
|
86 | 86 | |
87 | - $this->logger->error("system error:" . $ex->getMessage()); |
|
87 | + $this->logger->error("system error:" . $ex->getMessage()); |
|
88 | 88 | |
89 | - $this->logger->info("Произошла ошибка при сохранении пользователя"); |
|
90 | - } |
|
89 | + $this->logger->info("Произошла ошибка при сохранении пользователя"); |
|
90 | + } |
|
91 | 91 | } |
92 | 92 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * |
11 | 11 | * @author d.lanec |
12 | 12 | */ |
13 | -class UserList extends Controllers\ModuleController{ |
|
13 | +class UserList extends Controllers\ModuleController { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * UserRepository |
@@ -26,20 +26,20 @@ discard block |
||
26 | 26 | |
27 | 27 | protected $limit = 5; |
28 | 28 | |
29 | - function __construct(\Core\Models\User\UserRepository $userRepository, Request $request){ |
|
30 | - $this->userRepository = $userRepository; |
|
31 | - $this->request = $request; |
|
29 | + function __construct(\Core\Models\User\UserRepository $userRepository, Request $request) { |
|
30 | + $this->userRepository = $userRepository; |
|
31 | + $this->request = $request; |
|
32 | 32 | } |
33 | 33 | |
34 | - public function process(){ |
|
34 | + public function process() { |
|
35 | 35 | |
36 | - if($this->request->query->get('fn') == 'add'){ |
|
36 | + if ($this->request->query->get('fn') == 'add') { |
|
37 | 37 | $this->add(); |
38 | 38 | } |
39 | 39 | |
40 | 40 | $Users = $this->userRepository->findMany([], $this->limit); |
41 | 41 | |
42 | - $table = Table::create(); |
|
42 | + $table = Table::create(); |
|
43 | 43 | $table->addColNames([0, 1, 2, 3]); |
44 | 44 | $table->addClass('table table-striped'); |
45 | 45 | $table->thead() |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | ->th('head row', 1, 'Регистрация') |
49 | 49 | ->th('head row', 2, 'Имя') |
50 | 50 | ->th('head row', 3, 'Email'); |
51 | - $i = 0; |
|
52 | - foreach($Users as $User){ |
|
51 | + $i = 0; |
|
52 | + foreach ($Users as $User) { |
|
53 | 53 | $table->addRow($i)->tdMultiple([ |
54 | 54 | $User->getId(), |
55 | 55 | $User->getCreatedAt("d.m.Y"), |
@@ -63,26 +63,26 @@ discard block |
||
63 | 63 | ]); |
64 | 64 | } |
65 | 65 | |
66 | - protected function add(){ |
|
66 | + protected function add() { |
|
67 | 67 | |
68 | - try{ |
|
68 | + try { |
|
69 | 69 | |
70 | 70 | $User = $this->userRepository->build(); |
71 | 71 | $User->setEmail('[email protected]'); |
72 | 72 | |
73 | - if(!$this->userRepository->save($User)){ |
|
73 | + if (!$this->userRepository->save($User)) { |
|
74 | 74 | throw new Exception('User not save'); |
75 | - } else{ |
|
75 | + } else { |
|
76 | 76 | $this->logger->info("Пользователь успешно сохранен!"); |
77 | 77 | } |
78 | - } catch(\Frameworkless\Exceptions\ValidationException $ex){ |
|
78 | + } catch (\Frameworkless\Exceptions\ValidationException $ex) { |
|
79 | 79 | |
80 | - foreach($ex->getFailures() as $failure){ |
|
80 | + foreach ($ex->getFailures() as $failure) { |
|
81 | 81 | $this->logger->error("Property " . $failure->getPropertyPath() . ": " . $failure->getMessage() . "\n"); |
82 | 82 | } |
83 | 83 | |
84 | 84 | $this->logger->info("Произошла ошибка при сохранении пользователя"); |
85 | - } catch(\Exception $ex){ |
|
85 | + } catch (\Exception $ex) { |
|
86 | 86 | |
87 | 87 | $this->logger->error("system error:" . $ex->getMessage()); |
88 | 88 |
@@ -16,6 +16,6 @@ |
||
16 | 16 | class User extends BaseUser |
17 | 17 | { |
18 | 18 | |
19 | - use \Frameworkless\ValidatorTrait; |
|
19 | + use \Frameworkless\ValidatorTrait; |
|
20 | 20 | |
21 | 21 | } |
@@ -25,36 +25,36 @@ discard block |
||
25 | 25 | * set Monolog |
26 | 26 | */ |
27 | 27 | $container->share(Monolog\Logger::class) |
28 | - ->withArgument('myLogger') |
|
29 | - ; |
|
28 | + ->withArgument('myLogger') |
|
29 | + ; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * set Propel2 Logger |
33 | 33 | */ |
34 | 34 | Propel\Runtime\Propel::getServiceContainer()->setLogger('defaultLogger', |
35 | - (new Monolog\Logger('defaultLogger')) |
|
36 | - ->pushHandler(new Monolog\Handler\StreamHandler('php://stderr')) |
|
37 | - ); |
|
35 | + (new Monolog\Logger('defaultLogger')) |
|
36 | + ->pushHandler(new Monolog\Handler\StreamHandler('php://stderr')) |
|
37 | + ); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * set Debug bar |
41 | 41 | */ |
42 | 42 | $container->share(DebugBar\StandardDebugBar::class) |
43 | - ->withMethodCall("addCollector",[ |
|
44 | - new DebugBar\Bridge\Twig\TwigCollector( |
|
45 | - new DebugBar\Bridge\Twig\TraceableTwigEnvironment( |
|
46 | - $container->get(Twig_Environment::class), |
|
47 | - new DebugBar\DataCollector\TimeDataCollector |
|
48 | - ) |
|
49 | - ) |
|
50 | - ]) |
|
51 | - ->withMethodCall("addCollector",[ |
|
52 | - new DebugBar\Bridge\Propel2Collector(Propel\Runtime\Propel::getConnection()) |
|
53 | - ]) |
|
54 | - ->withMethodCall("addCollector",[ |
|
55 | - new \DebugBar\Bridge\MonologCollector($container->get(Monolog\Logger::class)) |
|
56 | - ]) |
|
57 | - ; |
|
43 | + ->withMethodCall("addCollector",[ |
|
44 | + new DebugBar\Bridge\Twig\TwigCollector( |
|
45 | + new DebugBar\Bridge\Twig\TraceableTwigEnvironment( |
|
46 | + $container->get(Twig_Environment::class), |
|
47 | + new DebugBar\DataCollector\TimeDataCollector |
|
48 | + ) |
|
49 | + ) |
|
50 | + ]) |
|
51 | + ->withMethodCall("addCollector",[ |
|
52 | + new DebugBar\Bridge\Propel2Collector(Propel\Runtime\Propel::getConnection()) |
|
53 | + ]) |
|
54 | + ->withMethodCall("addCollector",[ |
|
55 | + new \DebugBar\Bridge\MonologCollector($container->get(Monolog\Logger::class)) |
|
56 | + ]) |
|
57 | + ; |
|
58 | 58 | ; |
59 | 59 | |
60 | 60 | |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | */ |
64 | 64 | |
65 | 65 | $container->inflector(Psr\Log\LoggerAwareInterface::class) |
66 | - ->invokeMethod('setLogger', [$container->get(Monolog\Logger::class)]); |
|
66 | + ->invokeMethod('setLogger', [$container->get(Monolog\Logger::class)]); |
|
67 | 67 | |
68 | 68 | $container->inflector(Frameworkless\Controllers\PageInterface::class) |
69 | - ->invokeMethod('setTwig', [$container->get(Twig_Environment::class)]) |
|
70 | - ->invokeMethod('setDebugbar', [$container->get(DebugBar\StandardDebugBar::class)]) |
|
71 | - ; |
|
69 | + ->invokeMethod('setTwig', [$container->get(Twig_Environment::class)]) |
|
70 | + ->invokeMethod('setDebugbar', [$container->get(DebugBar\StandardDebugBar::class)]) |
|
71 | + ; |
|
72 | 72 | |
73 | 73 | |
74 | 74 | App::getInstance()->import("DI", $container); |
75 | 75 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * set Request |
15 | 15 | */ |
16 | -$container->add(Request::class,Request::createFromGlobals()); |
|
16 | +$container->add(Request::class, Request::createFromGlobals()); |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * set Twig |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * set Debug bar |
41 | 41 | */ |
42 | 42 | $container->share(DebugBar\StandardDebugBar::class) |
43 | - ->withMethodCall("addCollector",[ |
|
43 | + ->withMethodCall("addCollector", [ |
|
44 | 44 | new DebugBar\Bridge\Twig\TwigCollector( |
45 | 45 | new DebugBar\Bridge\Twig\TraceableTwigEnvironment( |
46 | 46 | $container->get(Twig_Environment::class), |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | ) |
49 | 49 | ) |
50 | 50 | ]) |
51 | - ->withMethodCall("addCollector",[ |
|
51 | + ->withMethodCall("addCollector", [ |
|
52 | 52 | new DebugBar\Bridge\Propel2Collector(Propel\Runtime\Propel::getConnection()) |
53 | 53 | ]) |
54 | - ->withMethodCall("addCollector",[ |
|
54 | + ->withMethodCall("addCollector", [ |
|
55 | 55 | new \DebugBar\Bridge\MonologCollector($container->get(Monolog\Logger::class)) |
56 | 56 | ]) |
57 | 57 | ; |
@@ -3,53 +3,53 @@ |
||
3 | 3 | class App |
4 | 4 | { |
5 | 5 | |
6 | - private $settings = array(); |
|
6 | + private $settings = array(); |
|
7 | 7 | |
8 | - private static $_instance = null; |
|
9 | - |
|
10 | - private function __construct() |
|
11 | - { |
|
12 | - // приватный конструктор ограничивает реализацию getInstance () |
|
13 | - } |
|
14 | - |
|
15 | - protected function __clone() |
|
16 | - { |
|
17 | - // ограничивает клонирование объекта |
|
18 | - } |
|
19 | - |
|
20 | - /** |
|
21 | - * Вызов модуля |
|
22 | - * @param type $name |
|
23 | - * @param array $params |
|
24 | - * @return string |
|
25 | - */ |
|
26 | - static function getModule($name, array $params = []) |
|
27 | - { |
|
28 | - $DI = self::getInstance()->load("DI"); |
|
29 | - $debugbar = $DI->get(DebugBar\StandardDebugBar::class); |
|
30 | - $debugbar['messages']->debug(sprintf('App::getModule %s, with params %s' , $name, json_encode($params) )); |
|
31 | - $debugbar['time']->startMeasure($name, 'Load module ' . $name); |
|
32 | - $module = $DI->get($name); |
|
33 | - $result = $module->setParams($params)->process(); |
|
34 | - $debugbar['time']->stopMeasure($name); |
|
35 | - return $result; |
|
36 | - } |
|
37 | - |
|
38 | - static public function getInstance() |
|
39 | - { |
|
40 | - if (is_null(self::$_instance)) { |
|
41 | - self::$_instance = new self(); |
|
42 | - } |
|
43 | - return self::$_instance; |
|
44 | - } |
|
45 | - |
|
46 | - public function import($key,$value) |
|
47 | - { |
|
48 | - $this->settings[$key] = $value; |
|
49 | - } |
|
50 | - |
|
51 | - public function load($key) |
|
52 | - { |
|
53 | - return $this->settings[$key]; |
|
54 | - } |
|
8 | + private static $_instance = null; |
|
9 | + |
|
10 | + private function __construct() |
|
11 | + { |
|
12 | + // приватный конструктор ограничивает реализацию getInstance () |
|
13 | + } |
|
14 | + |
|
15 | + protected function __clone() |
|
16 | + { |
|
17 | + // ограничивает клонирование объекта |
|
18 | + } |
|
19 | + |
|
20 | + /** |
|
21 | + * Вызов модуля |
|
22 | + * @param type $name |
|
23 | + * @param array $params |
|
24 | + * @return string |
|
25 | + */ |
|
26 | + static function getModule($name, array $params = []) |
|
27 | + { |
|
28 | + $DI = self::getInstance()->load("DI"); |
|
29 | + $debugbar = $DI->get(DebugBar\StandardDebugBar::class); |
|
30 | + $debugbar['messages']->debug(sprintf('App::getModule %s, with params %s' , $name, json_encode($params) )); |
|
31 | + $debugbar['time']->startMeasure($name, 'Load module ' . $name); |
|
32 | + $module = $DI->get($name); |
|
33 | + $result = $module->setParams($params)->process(); |
|
34 | + $debugbar['time']->stopMeasure($name); |
|
35 | + return $result; |
|
36 | + } |
|
37 | + |
|
38 | + static public function getInstance() |
|
39 | + { |
|
40 | + if (is_null(self::$_instance)) { |
|
41 | + self::$_instance = new self(); |
|
42 | + } |
|
43 | + return self::$_instance; |
|
44 | + } |
|
45 | + |
|
46 | + public function import($key,$value) |
|
47 | + { |
|
48 | + $this->settings[$key] = $value; |
|
49 | + } |
|
50 | + |
|
51 | + public function load($key) |
|
52 | + { |
|
53 | + return $this->settings[$key]; |
|
54 | + } |
|
55 | 55 | } |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | */ |
26 | 26 | static function getModule($name, array $params = []) |
27 | 27 | { |
28 | - $DI = self::getInstance()->load("DI"); |
|
29 | - $debugbar = $DI->get(DebugBar\StandardDebugBar::class); |
|
30 | - $debugbar['messages']->debug(sprintf('App::getModule %s, with params %s' , $name, json_encode($params) )); |
|
28 | + $DI = self::getInstance()->load("DI"); |
|
29 | + $debugbar = $DI->get(DebugBar\StandardDebugBar::class); |
|
30 | + $debugbar['messages']->debug(sprintf('App::getModule %s, with params %s', $name, json_encode($params))); |
|
31 | 31 | $debugbar['time']->startMeasure($name, 'Load module ' . $name); |
32 | 32 | $module = $DI->get($name); |
33 | 33 | $result = $module->setParams($params)->process(); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | return self::$_instance; |
44 | 44 | } |
45 | 45 | |
46 | - public function import($key,$value) |
|
46 | + public function import($key, $value) |
|
47 | 47 | { |
48 | 48 | $this->settings[$key] = $value; |
49 | 49 | } |
@@ -4,10 +4,7 @@ |
||
4 | 4 | use Symfony\Component\Console\Command\Command; |
5 | 5 | use Symfony\Component\Console\Input\InputInterface; |
6 | 6 | use Symfony\Component\Console\Output\OutputInterface; |
7 | -use Symfony\Component\Console\Input\StringInput; |
|
8 | 7 | use Symfony\Component\Console\Input\ArrayInput; |
9 | -use Symfony\Component\Process\Process; |
|
10 | -use Symfony\Component\Process\Exception\ProcessFailedException; |
|
11 | 8 | |
12 | 9 | /** |
13 | 10 | * Description of HelloWorldCommand |
@@ -17,27 +17,27 @@ |
||
17 | 17 | class InstallCommand extends Command{ |
18 | 18 | |
19 | 19 | protected function configure(){ |
20 | - $this->setName('install') |
|
21 | - ->setDescription('Install project, up migration and seeds'); |
|
20 | + $this->setName('install') |
|
21 | + ->setDescription('Install project, up migration and seeds'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | protected function execute(InputInterface $input, OutputInterface $output){ |
25 | 25 | |
26 | - $command = $this->getApplication()->find('config:convert'); |
|
27 | - $returnCode = $command->run(new ArrayInput([ |
|
28 | - 'command' => 'config:convert' |
|
29 | - ]), $output); |
|
26 | + $command = $this->getApplication()->find('config:convert'); |
|
27 | + $returnCode = $command->run(new ArrayInput([ |
|
28 | + 'command' => 'config:convert' |
|
29 | + ]), $output); |
|
30 | 30 | |
31 | - $command = $this->getApplication()->find('packages:install'); |
|
32 | - $returnCode = $command->run(new ArrayInput([ |
|
33 | - 'command' => 'packages:install' |
|
34 | - ]), $output); |
|
31 | + $command = $this->getApplication()->find('packages:install'); |
|
32 | + $returnCode = $command->run(new ArrayInput([ |
|
33 | + 'command' => 'packages:install' |
|
34 | + ]), $output); |
|
35 | 35 | |
36 | - $command = $this->getApplication()->find('migration:migrate'); |
|
37 | - $returnCode = $command->run(new ArrayInput([ |
|
38 | - 'command' => 'migration:migrate' |
|
39 | - ]), $output); |
|
36 | + $command = $this->getApplication()->find('migration:migrate'); |
|
37 | + $returnCode = $command->run(new ArrayInput([ |
|
38 | + 'command' => 'migration:migrate' |
|
39 | + ]), $output); |
|
40 | 40 | |
41 | - $output->writeln("install completed!"); |
|
41 | + $output->writeln("install completed!"); |
|
42 | 42 | } |
43 | 43 | } |
@@ -14,27 +14,27 @@ |
||
14 | 14 | * |
15 | 15 | * @author Dmitriy |
16 | 16 | */ |
17 | -class InstallCommand extends Command{ |
|
17 | +class InstallCommand extends Command { |
|
18 | 18 | |
19 | - protected function configure(){ |
|
19 | + protected function configure() { |
|
20 | 20 | $this->setName('install') |
21 | 21 | ->setDescription('Install project, up migration and seeds'); |
22 | 22 | } |
23 | 23 | |
24 | - protected function execute(InputInterface $input, OutputInterface $output){ |
|
24 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
25 | 25 | |
26 | - $command = $this->getApplication()->find('config:convert'); |
|
27 | - $returnCode = $command->run(new ArrayInput([ |
|
26 | + $command = $this->getApplication()->find('config:convert'); |
|
27 | + $returnCode = $command->run(new ArrayInput([ |
|
28 | 28 | 'command' => 'config:convert' |
29 | 29 | ]), $output); |
30 | 30 | |
31 | - $command = $this->getApplication()->find('packages:install'); |
|
32 | - $returnCode = $command->run(new ArrayInput([ |
|
31 | + $command = $this->getApplication()->find('packages:install'); |
|
32 | + $returnCode = $command->run(new ArrayInput([ |
|
33 | 33 | 'command' => 'packages:install' |
34 | 34 | ]), $output); |
35 | 35 | |
36 | - $command = $this->getApplication()->find('migration:migrate'); |
|
37 | - $returnCode = $command->run(new ArrayInput([ |
|
36 | + $command = $this->getApplication()->find('migration:migrate'); |
|
37 | + $returnCode = $command->run(new ArrayInput([ |
|
38 | 38 | 'command' => 'migration:migrate' |
39 | 39 | ]), $output); |
40 | 40 |
@@ -3,11 +3,6 @@ |
||
3 | 3 | namespace Frameworkless\Console; |
4 | 4 | |
5 | 5 | use Symfony\Component\Console\Application as CoreApp; |
6 | -use Symfony\Component\Console\Input\InputInterface; |
|
7 | -use Symfony\Component\Console\Output\OutputInterface; |
|
8 | -use Symfony\Component\Console\Input\InputArgument; |
|
9 | -use Symfony\Component\Console\Input\InputOption; |
|
10 | -use Symfony\Component\Finder\Finder; |
|
11 | 6 | |
12 | 7 | class Application extends CoreApp |
13 | 8 | { |
@@ -16,18 +16,18 @@ |
||
16 | 16 | * @return array An array of default Command instances |
17 | 17 | */ |
18 | 18 | protected function getDefaultCommands(){ |
19 | - // Keep the core default commands to have the HelpCommand |
|
20 | - // which is used when using the --help option |
|
21 | - $defaultCommands = parent::getDefaultCommands(); |
|
19 | + // Keep the core default commands to have the HelpCommand |
|
20 | + // which is used when using the --help option |
|
21 | + $defaultCommands = parent::getDefaultCommands(); |
|
22 | 22 | |
23 | - $defaultCommands [] = new Commands\InfoCommand(); |
|
24 | - $defaultCommands [] = new Commands\InstallPackagesCommand; |
|
25 | - $defaultCommands [] = new Commands\SeedBuildCommand; |
|
26 | - $defaultCommands [] = new Commands\SeedResetCommand; |
|
27 | - $defaultCommands [] = new Commands\InstallCommand; |
|
28 | - $defaultCommands [] = new \Propel\Generator\Command\ConfigConvertCommand(); |
|
29 | - $defaultCommands [] = new \Propel\Generator\Command\MigrationMigrateCommand(); |
|
23 | + $defaultCommands [] = new Commands\InfoCommand(); |
|
24 | + $defaultCommands [] = new Commands\InstallPackagesCommand; |
|
25 | + $defaultCommands [] = new Commands\SeedBuildCommand; |
|
26 | + $defaultCommands [] = new Commands\SeedResetCommand; |
|
27 | + $defaultCommands [] = new Commands\InstallCommand; |
|
28 | + $defaultCommands [] = new \Propel\Generator\Command\ConfigConvertCommand(); |
|
29 | + $defaultCommands [] = new \Propel\Generator\Command\MigrationMigrateCommand(); |
|
30 | 30 | |
31 | - return $defaultCommands; |
|
31 | + return $defaultCommands; |
|
32 | 32 | } |
33 | 33 | } |
@@ -8,14 +8,14 @@ |
||
8 | 8 | use Symfony\Component\Console\Input\InputOption; |
9 | 9 | use Symfony\Component\Finder\Finder; |
10 | 10 | |
11 | -class Application extends CoreApp{ |
|
11 | +class Application extends CoreApp { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Gets the default commands that should always be available. |
15 | 15 | * |
16 | 16 | * @return array An array of default Command instances |
17 | 17 | */ |
18 | - protected function getDefaultCommands(){ |
|
18 | + protected function getDefaultCommands() { |
|
19 | 19 | // Keep the core default commands to have the HelpCommand |
20 | 20 | // which is used when using the --help option |
21 | 21 | $defaultCommands = parent::getDefaultCommands(); |