@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | - $con->transaction(function () use ($con) { |
|
| 714 | + $con->transaction(function() use ($con) { |
|
| 715 | 715 | $deleteQuery = ChildUserQuery::create() |
| 716 | 716 | ->filterByPrimaryKey($this->getPrimaryKey()); |
| 717 | 717 | $ret = $this->preDelete($con); |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
| 747 | 747 | } |
| 748 | 748 | |
| 749 | - return $con->transaction(function () use ($con) { |
|
| 749 | + return $con->transaction(function() use ($con) { |
|
| 750 | 750 | $isInsert = $this->isNew(); |
| 751 | 751 | $ret = $this->preSave($con); |
| 752 | 752 | if ($isInsert) { |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | function __construct(\Core\Models\User\UserRepository $userRepository, Request $request) |
| 25 | 25 | {
|
| 26 | - $this->userRepository = $userRepository; |
|
| 27 | - $this->request = $request; |
|
| 26 | + $this->userRepository = $userRepository; |
|
| 27 | + $this->request = $request; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function process() |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $this->logger->debug('UserList start');
|
| 34 | 34 | |
| 35 | - if ($this->request->query->get('fn')=='add') {
|
|
| 35 | + if ($this->request->query->get('fn') == 'add') {
|
|
| 36 | 36 | $this->add(); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $Users = $this->userRepository->findMany(); |
| 40 | 40 | |
| 41 | - $table = Table::create(); |
|
| 41 | + $table = Table::create(); |
|
| 42 | 42 | $table->addColNames([0, 1, 2]); |
| 43 | 43 | $table->addClass('table table-striped');
|
| 44 | 44 | $table->thead() |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | ->th('head row', 0, 'Id')
|
| 47 | 47 | ->th('head row', 1, 'Имя')
|
| 48 | 48 | ->th('head row', 2, 'Email');
|
| 49 | - $i = 0; |
|
| 49 | + $i = 0; |
|
| 50 | 50 | foreach ($Users as $User) {
|
| 51 | 51 | $table->addRow($i)->tdMultiple([ |
| 52 | 52 | $User->getId(), |
@@ -73,14 +73,14 @@ discard block |
||
| 73 | 73 | } else {
|
| 74 | 74 | $this->logger->info("Пользователь успешно сохранен!");
|
| 75 | 75 | } |
| 76 | - } catch(\Frameworkless\Exceptions\ValidationException $ex) {
|
|
| 76 | + } catch (\Frameworkless\Exceptions\ValidationException $ex) {
|
|
| 77 | 77 | |
| 78 | 78 | foreach ($ex->getFailures() as $failure) {
|
| 79 | 79 | $this->logger->error("Property " . $failure->getPropertyPath() . ": " . $failure->getMessage() . "\n");
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $this->logger->info("Произошла ошибка при сохранении пользователя");
|
| 83 | - } catch(\Exception $ex) {
|
|
| 83 | + } catch (\Exception $ex) {
|
|
| 84 | 84 | |
| 85 | 85 | $this->logger->error("system error:" . $ex->getMessage());
|
| 86 | 86 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | public function findById($id) |
| 29 | 29 | { |
| 30 | 30 | if (!$User = UserQuery::create()->findPk($id)) { |
| 31 | - throw new \InvalidArgumentException(sprintf('User with ID %d does not exist',$id)); |
|
| 31 | + throw new \InvalidArgumentException(sprintf('User with ID %d does not exist', $id)); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | return $User; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @return \Core\Models\User\User $User |
| 61 | 61 | */ |
| 62 | - public function build(){ |
|
| 62 | + public function build() { |
|
| 63 | 63 | return new User; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | - $con->transaction(function () use ($con) { |
|
| 742 | + $con->transaction(function() use ($con) { |
|
| 743 | 743 | $deleteQuery = ChildUserQuery::create() |
| 744 | 744 | ->filterByPrimaryKey($this->getPrimaryKey()); |
| 745 | 745 | $ret = $this->preDelete($con); |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
| 775 | 775 | } |
| 776 | 776 | |
| 777 | - return $con->transaction(function () use ($con) { |
|
| 777 | + return $con->transaction(function() use ($con) { |
|
| 778 | 778 | $isInsert = $this->isNew(); |
| 779 | 779 | $ret = $this->preSave($con); |
| 780 | 780 | if ($isInsert) { |
@@ -1384,8 +1384,8 @@ discard block |
||
| 1384 | 1384 | */ |
| 1385 | 1385 | static public function loadValidatorMetadata(ClassMetadata $metadata) |
| 1386 | 1386 | { |
| 1387 | - $metadata->addPropertyConstraint('email', new Email(array ('message' => 'поле Email не заполнено',))); |
|
| 1388 | - $metadata->addPropertyConstraint('email', new Unique(array ('message' => 'Email должен быть уникален',))); |
|
| 1387 | + $metadata->addPropertyConstraint('email', new Email(array('message' => 'поле Email не заполнено',))); |
|
| 1388 | + $metadata->addPropertyConstraint('email', new Unique(array('message' => 'Email должен быть уникален',))); |
|
| 1389 | 1389 | } |
| 1390 | 1390 | |
| 1391 | 1391 | /** |
@@ -1398,13 +1398,13 @@ discard block |
||
| 1398 | 1398 | public function validate(ValidatorInterface $validator = null) |
| 1399 | 1399 | { |
| 1400 | 1400 | if (null === $validator) { |
| 1401 | - if(class_exists('Symfony\\Component\\Validator\\Validator\\LegacyValidator')){ |
|
| 1401 | + if (class_exists('Symfony\\Component\\Validator\\Validator\\LegacyValidator')) { |
|
| 1402 | 1402 | $validator = new LegacyValidator( |
| 1403 | 1403 | new ExecutionContextFactory(new DefaultTranslator()), |
| 1404 | 1404 | new ClassMetaDataFactory(new StaticMethodLoader()), |
| 1405 | 1405 | new ConstraintValidatorFactory() |
| 1406 | 1406 | ); |
| 1407 | - }else{ |
|
| 1407 | + } else { |
|
| 1408 | 1408 | $validator = new Validator( |
| 1409 | 1409 | new ClassMetadataFactory(new StaticMethodLoader()), |
| 1410 | 1410 | new ConstraintValidatorFactory(), |
@@ -117,12 +117,12 @@ discard block |
||
| 117 | 117 | * first dimension keys are the type constants |
| 118 | 118 | * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
| 119 | 119 | */ |
| 120 | - protected static $fieldNames = array ( |
|
| 121 | - self::TYPE_PHPNAME => array('Id', 'Name', 'Email', 'Password', 'RememberToken', 'CreatedAt', 'UpdatedAt', ), |
|
| 122 | - self::TYPE_CAMELNAME => array('id', 'name', 'email', 'password', 'rememberToken', 'createdAt', 'updatedAt', ), |
|
| 123 | - self::TYPE_COLNAME => array(UserTableMap::COL_ID, UserTableMap::COL_NAME, UserTableMap::COL_EMAIL, UserTableMap::COL_PASSWORD, UserTableMap::COL_REMEMBER_TOKEN, UserTableMap::COL_CREATED_AT, UserTableMap::COL_UPDATED_AT, ), |
|
| 124 | - self::TYPE_FIELDNAME => array('id', 'name', 'email', 'password', 'remember_token', 'created_at', 'updated_at', ), |
|
| 125 | - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) |
|
| 120 | + protected static $fieldNames = array( |
|
| 121 | + self::TYPE_PHPNAME => array('Id', 'Name', 'Email', 'Password', 'RememberToken', 'CreatedAt', 'UpdatedAt',), |
|
| 122 | + self::TYPE_CAMELNAME => array('id', 'name', 'email', 'password', 'rememberToken', 'createdAt', 'updatedAt',), |
|
| 123 | + self::TYPE_COLNAME => array(UserTableMap::COL_ID, UserTableMap::COL_NAME, UserTableMap::COL_EMAIL, UserTableMap::COL_PASSWORD, UserTableMap::COL_REMEMBER_TOKEN, UserTableMap::COL_CREATED_AT, UserTableMap::COL_UPDATED_AT,), |
|
| 124 | + self::TYPE_FIELDNAME => array('id', 'name', 'email', 'password', 'remember_token', 'created_at', 'updated_at',), |
|
| 125 | + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6,) |
|
| 126 | 126 | ); |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | * first dimension keys are the type constants |
| 132 | 132 | * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
| 133 | 133 | */ |
| 134 | - protected static $fieldKeys = array ( |
|
| 135 | - self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Email' => 2, 'Password' => 3, 'RememberToken' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ), |
|
| 136 | - self::TYPE_CAMELNAME => array('id' => 0, 'name' => 1, 'email' => 2, 'password' => 3, 'rememberToken' => 4, 'createdAt' => 5, 'updatedAt' => 6, ), |
|
| 137 | - self::TYPE_COLNAME => array(UserTableMap::COL_ID => 0, UserTableMap::COL_NAME => 1, UserTableMap::COL_EMAIL => 2, UserTableMap::COL_PASSWORD => 3, UserTableMap::COL_REMEMBER_TOKEN => 4, UserTableMap::COL_CREATED_AT => 5, UserTableMap::COL_UPDATED_AT => 6, ), |
|
| 138 | - self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'email' => 2, 'password' => 3, 'remember_token' => 4, 'created_at' => 5, 'updated_at' => 6, ), |
|
| 139 | - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) |
|
| 134 | + protected static $fieldKeys = array( |
|
| 135 | + self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Email' => 2, 'Password' => 3, 'RememberToken' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6,), |
|
| 136 | + self::TYPE_CAMELNAME => array('id' => 0, 'name' => 1, 'email' => 2, 'password' => 3, 'rememberToken' => 4, 'createdAt' => 5, 'updatedAt' => 6,), |
|
| 137 | + self::TYPE_COLNAME => array(UserTableMap::COL_ID => 0, UserTableMap::COL_NAME => 1, UserTableMap::COL_EMAIL => 2, UserTableMap::COL_PASSWORD => 3, UserTableMap::COL_REMEMBER_TOKEN => 4, UserTableMap::COL_CREATED_AT => 5, UserTableMap::COL_UPDATED_AT => 6,), |
|
| 138 | + self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'email' => 2, 'password' => 3, 'remember_token' => 4, 'created_at' => 5, 'updated_at' => 6,), |
|
| 139 | + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6,) |
|
| 140 | 140 | ); |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | public function getBehaviors() |
| 182 | 182 | { |
| 183 | 183 | return array( |
| 184 | - 'validate' => array('rule1' => array ('column' => 'email','validator' => 'Email','options' => array ('message' => 'поле Email не заполнено',),), 'rule2' => array ('column' => 'email','validator' => 'Unique','options' => array ('message' => 'Email должен быть уникален',),), ), |
|
| 184 | + 'validate' => array('rule1' => array('column' => 'email', 'validator' => 'Email', 'options' => array('message' => 'поле Email не заполнено',),), 'rule2' => array('column' => 'email', 'validator' => 'Unique', 'options' => array('message' => 'Email должен быть уникален',),),), |
|
| 185 | 185 | ); |
| 186 | 186 | } // getBehaviors() |
| 187 | 187 | |
@@ -440,8 +440,8 @@ discard block |
||
| 440 | 440 | $criteria = $criteria->buildCriteria(); // build Criteria from User object |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - if ($criteria->containsKey(UserTableMap::COL_ID) && $criteria->keyContainsValue(UserTableMap::COL_ID) ) { |
|
| 444 | - throw new PropelException('Cannot insert a value for auto-increment primary key ('.UserTableMap::COL_ID.')'); |
|
| 443 | + if ($criteria->containsKey(UserTableMap::COL_ID) && $criteria->keyContainsValue(UserTableMap::COL_ID)) { |
|
| 444 | + throw new PropelException('Cannot insert a value for auto-increment primary key (' . UserTableMap::COL_ID . ')'); |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | |
| 451 | 451 | // use transaction because $criteria could contain info |
| 452 | 452 | // for more than one table (I guess, conceivably) |
| 453 | - return $con->transaction(function () use ($con, $query) { |
|
| 453 | + return $con->transaction(function() use ($con, $query) { |
|
| 454 | 454 | return $query->doInsert($con); |
| 455 | 455 | }); |
| 456 | 456 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | public function preSave(\Propel\Runtime\Connection\ConnectionInterface $con = null) |
| 34 | 34 | { |
| 35 | 35 | if (!$result = $this->validate($this->validator)) { |
| 36 | - throw new ValidationException($this->getValidationFailures(),"Validation error"); |
|
| 36 | + throw new ValidationException($this->getValidationFailures(), "Validation error"); |
|
| 37 | 37 | } |
| 38 | 38 | return $result; |
| 39 | 39 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @param Twig_Environment $twig |
| 16 | 16 | */ |
| 17 | - public function __construct( UserList $userListModule) { |
|
| 17 | + public function __construct(UserList $userListModule) { |
|
| 18 | 18 | |
| 19 | 19 | $this->userListModule = $userListModule; |
| 20 | 20 | } |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function get($args) { |
| 29 | 29 | |
| 30 | - $result = \App::getModule(UserList::class,[ |
|
| 30 | + $result = \App::getModule(UserList::class, [ |
|
| 31 | 31 | "limit" => 2 |
| 32 | 32 | ]); |
| 33 | 33 | |
| 34 | - $result .= \App::getModule(UserList::class,[ |
|
| 34 | + $result .= \App::getModule(UserList::class, [ |
|
| 35 | 35 | "limit" => 1 |
| 36 | 36 | ]); |
| 37 | 37 | |
@@ -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 | ; |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | return self::$_instance; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function import($key,$value) |
|
| 38 | + public function import($key, $value) |
|
| 39 | 39 | { |
| 40 | 40 | $this->settings[$key] = $value; |
| 41 | 41 | } |