@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | * |
| 317 | 317 | * @param string $msg |
| 318 | 318 | * @param int $priority One of the Propel::LOG_* logging levels |
| 319 | - * @return boolean |
|
| 319 | + * @return boolean|null |
|
| 320 | 320 | */ |
| 321 | 321 | protected function log($msg, $priority = Propel::LOG_INFO) |
| 322 | 322 | { |
@@ -1159,7 +1159,7 @@ discard block |
||
| 1159 | 1159 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
| 1160 | 1160 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
| 1161 | 1161 | * |
| 1162 | - * @param mixed $parser A AbstractParser instance, |
|
| 1162 | + * @param string $parser A AbstractParser instance, |
|
| 1163 | 1163 | * or a format name ('XML', 'YAML', 'JSON', 'CSV') |
| 1164 | 1164 | * @param string $data The source data to import from |
| 1165 | 1165 | * @param string $keyType The type of keys the array uses. |
@@ -1390,7 +1390,7 @@ discard block |
||
| 1390 | 1390 | * Validates the object and all objects related to this table. |
| 1391 | 1391 | * |
| 1392 | 1392 | * @see getValidationFailures() |
| 1393 | - * @param object $validator A Validator class instance |
|
| 1393 | + * @param ValidatorInterface $validator A Validator class instance |
|
| 1394 | 1394 | * @return boolean Whether all objects pass validation. |
| 1395 | 1395 | */ |
| 1396 | 1396 | public function validate(ValidatorInterface $validator = null) |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | * Gets any ConstraintViolation objects that resulted from last call to validate(). |
| 1438 | 1438 | * |
| 1439 | 1439 | * |
| 1440 | - * @return object ConstraintViolationList |
|
| 1440 | + * @return ConstraintViolationList ConstraintViolationList |
|
| 1441 | 1441 | * @see validate() |
| 1442 | 1442 | */ |
| 1443 | 1443 | public function getValidationFailures() |
@@ -1402,7 +1402,7 @@ |
||
| 1402 | 1402 | new ClassMetaDataFactory(new StaticMethodLoader()), |
| 1403 | 1403 | new ConstraintValidatorFactory() |
| 1404 | 1404 | ); |
| 1405 | - }else{ |
|
| 1405 | + } else{ |
|
| 1406 | 1406 | $validator = new Validator( |
| 1407 | 1407 | new ClassMetadataFactory(new StaticMethodLoader()), |
| 1408 | 1408 | new ConstraintValidatorFactory(), |
@@ -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(), |
@@ -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) { |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * IndexController, constructed by container |
| 14 | 14 | * |
| 15 | - * @param Twig_Environment $twig |
|
| 16 | 15 | */ |
| 17 | 16 | public function __construct( UserList $userListModule) { |
| 18 | 17 | |
@@ -7,37 +7,37 @@ |
||
| 7 | 7 | |
| 8 | 8 | class IndexController extends BaseController { |
| 9 | 9 | |
| 10 | - protected $userListModule; |
|
| 11 | - |
|
| 12 | - /** |
|
| 13 | - * IndexController, constructed by container |
|
| 14 | - * |
|
| 15 | - * @param Twig_Environment $twig |
|
| 16 | - */ |
|
| 17 | - public function __construct( UserList $userListModule) { |
|
| 18 | - |
|
| 19 | - $this->userListModule = $userListModule; |
|
| 20 | - } |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * Return index page (/) |
|
| 24 | - * |
|
| 25 | - * @param array $args |
|
| 26 | - * @return Response |
|
| 27 | - */ |
|
| 28 | - public function get($args) { |
|
| 10 | + protected $userListModule; |
|
| 11 | + |
|
| 12 | + /** |
|
| 13 | + * IndexController, constructed by container |
|
| 14 | + * |
|
| 15 | + * @param Twig_Environment $twig |
|
| 16 | + */ |
|
| 17 | + public function __construct( UserList $userListModule) { |
|
| 18 | + |
|
| 19 | + $this->userListModule = $userListModule; |
|
| 20 | + } |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * Return index page (/) |
|
| 24 | + * |
|
| 25 | + * @param array $args |
|
| 26 | + * @return Response |
|
| 27 | + */ |
|
| 28 | + public function get($args) { |
|
| 29 | 29 | |
| 30 | - $result = \App::getModule(UserList::class,[ |
|
| 31 | - "limit" => 2 |
|
| 32 | - ]); |
|
| 30 | + $result = \App::getModule(UserList::class,[ |
|
| 31 | + "limit" => 2 |
|
| 32 | + ]); |
|
| 33 | 33 | |
| 34 | - $result .= \App::getModule(UserList::class,[ |
|
| 35 | - "limit" => 1 |
|
| 36 | - ]); |
|
| 34 | + $result .= \App::getModule(UserList::class,[ |
|
| 35 | + "limit" => 1 |
|
| 36 | + ]); |
|
| 37 | 37 | |
| 38 | - return $this->render('pages/index.html.twig', [ |
|
| 39 | - "content" => $result, |
|
| 40 | - ]); |
|
| 41 | - } |
|
| 38 | + return $this->render('pages/index.html.twig', [ |
|
| 39 | + "content" => $result, |
|
| 40 | + ]); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | } |
@@ -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 | |
@@ -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 | /** |
@@ -13,78 +13,78 @@ |
||
| 13 | 13 | class UserList extends Controllers\ModuleController implements Controllers\ModuleInterface |
| 14 | 14 | {
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * |
|
| 18 | - * @var \Core\Models\User\UserRepository |
|
| 19 | - */ |
|
| 20 | - protected $userRepository; |
|
| 21 | - |
|
| 22 | - protected $request; |
|
| 23 | - |
|
| 24 | - function __construct(\Core\Models\User\UserRepository $userRepository, Request $request) |
|
| 25 | - {
|
|
| 26 | - $this->userRepository = $userRepository; |
|
| 27 | - $this->request = $request; |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - public function process() |
|
| 31 | - {
|
|
| 16 | + /** |
|
| 17 | + * |
|
| 18 | + * @var \Core\Models\User\UserRepository |
|
| 19 | + */ |
|
| 20 | + protected $userRepository; |
|
| 21 | + |
|
| 22 | + protected $request; |
|
| 23 | + |
|
| 24 | + function __construct(\Core\Models\User\UserRepository $userRepository, Request $request) |
|
| 25 | + {
|
|
| 26 | + $this->userRepository = $userRepository; |
|
| 27 | + $this->request = $request; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + public function process() |
|
| 31 | + {
|
|
| 32 | 32 | |
| 33 | - $this->logger->debug('UserList start');
|
|
| 34 | - |
|
| 35 | - if ($this->request->query->get('fn')=='add') {
|
|
| 36 | - $this->add(); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - $Users = $this->userRepository->findMany(); |
|
| 40 | - |
|
| 41 | - $table = Table::create(); |
|
| 42 | - $table->addColNames([0, 1, 2]); |
|
| 43 | - $table->addClass('table table-striped');
|
|
| 44 | - $table->thead() |
|
| 45 | - ->addRowName('head row')
|
|
| 46 | - ->th('head row', 0, 'Id')
|
|
| 47 | - ->th('head row', 1, 'Имя')
|
|
| 48 | - ->th('head row', 2, 'Email');
|
|
| 49 | - $i = 0; |
|
| 50 | - foreach ($Users as $User) {
|
|
| 51 | - $table->addRow($i)->tdMultiple([ |
|
| 52 | - $User->getId(), |
|
| 53 | - $User->getName(), |
|
| 54 | - $User->getEmail()]); |
|
| 55 | - $i++; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - return $this->render('default', [
|
|
| 59 | - 'table' => $table->render() |
|
| 60 | - ]); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - protected function add() |
|
| 64 | - {
|
|
| 65 | - |
|
| 66 | - try {
|
|
| 67 | - |
|
| 68 | - $User = $this->userRepository->build(); |
|
| 69 | - $User->setEmail('[email protected]');
|
|
| 70 | - |
|
| 71 | - if (!$this->userRepository->save($User)) {
|
|
| 72 | - throw new Exception('User not save');
|
|
| 73 | - } else {
|
|
| 74 | - $this->logger->info("Пользователь успешно сохранен!");
|
|
| 75 | - } |
|
| 76 | - } catch(\Frameworkless\Exceptions\ValidationException $ex) {
|
|
| 77 | - |
|
| 78 | - foreach ($ex->getFailures() as $failure) {
|
|
| 79 | - $this->logger->error("Property " . $failure->getPropertyPath() . ": " . $failure->getMessage() . "\n");
|
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - $this->logger->info("Произошла ошибка при сохранении пользователя");
|
|
| 83 | - } catch(\Exception $ex) {
|
|
| 84 | - |
|
| 85 | - $this->logger->error("system error:" . $ex->getMessage());
|
|
| 86 | - |
|
| 87 | - $this->logger->info("Произошла ошибка при сохранении пользователя");
|
|
| 88 | - } |
|
| 89 | - } |
|
| 33 | + $this->logger->debug('UserList start');
|
|
| 34 | + |
|
| 35 | + if ($this->request->query->get('fn')=='add') {
|
|
| 36 | + $this->add(); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + $Users = $this->userRepository->findMany(); |
|
| 40 | + |
|
| 41 | + $table = Table::create(); |
|
| 42 | + $table->addColNames([0, 1, 2]); |
|
| 43 | + $table->addClass('table table-striped');
|
|
| 44 | + $table->thead() |
|
| 45 | + ->addRowName('head row')
|
|
| 46 | + ->th('head row', 0, 'Id')
|
|
| 47 | + ->th('head row', 1, 'Имя')
|
|
| 48 | + ->th('head row', 2, 'Email');
|
|
| 49 | + $i = 0; |
|
| 50 | + foreach ($Users as $User) {
|
|
| 51 | + $table->addRow($i)->tdMultiple([ |
|
| 52 | + $User->getId(), |
|
| 53 | + $User->getName(), |
|
| 54 | + $User->getEmail()]); |
|
| 55 | + $i++; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + return $this->render('default', [
|
|
| 59 | + 'table' => $table->render() |
|
| 60 | + ]); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + protected function add() |
|
| 64 | + {
|
|
| 65 | + |
|
| 66 | + try {
|
|
| 67 | + |
|
| 68 | + $User = $this->userRepository->build(); |
|
| 69 | + $User->setEmail('[email protected]');
|
|
| 70 | + |
|
| 71 | + if (!$this->userRepository->save($User)) {
|
|
| 72 | + throw new Exception('User not save');
|
|
| 73 | + } else {
|
|
| 74 | + $this->logger->info("Пользователь успешно сохранен!");
|
|
| 75 | + } |
|
| 76 | + } catch(\Frameworkless\Exceptions\ValidationException $ex) {
|
|
| 77 | + |
|
| 78 | + foreach ($ex->getFailures() as $failure) {
|
|
| 79 | + $this->logger->error("Property " . $failure->getPropertyPath() . ": " . $failure->getMessage() . "\n");
|
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + $this->logger->info("Произошла ошибка при сохранении пользователя");
|
|
| 83 | + } catch(\Exception $ex) {
|
|
| 84 | + |
|
| 85 | + $this->logger->error("system error:" . $ex->getMessage());
|
|
| 86 | + |
|
| 87 | + $this->logger->info("Произошла ошибка при сохранении пользователя");
|
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | 90 | } |
@@ -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 | |
@@ -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 | } |
@@ -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 | } |
@@ -15,26 +15,26 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | trait ValidatorTrait |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Symfony\Component\Validator\Validator\RecursiveValidator |
|
| 20 | - * @var type |
|
| 21 | - */ |
|
| 22 | - protected $validator; |
|
| 18 | + /** |
|
| 19 | + * Symfony\Component\Validator\Validator\RecursiveValidator |
|
| 20 | + * @var type |
|
| 21 | + */ |
|
| 22 | + protected $validator; |
|
| 23 | 23 | |
| 24 | 24 | function __construct() |
| 25 | - { |
|
| 26 | - $this->validator = new RecursiveValidator( |
|
| 25 | + { |
|
| 26 | + $this->validator = new RecursiveValidator( |
|
| 27 | 27 | new ExecutionContextFactory(new IdentityTranslator()), |
| 28 | 28 | new LazyLoadingMetadataFactory(new StaticMethodLoader()), |
| 29 | 29 | new ConstraintValidatorFactory() |
| 30 | 30 | ); |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - public function preSave(\Propel\Runtime\Connection\ConnectionInterface $con = null) |
|
| 34 | - { |
|
| 33 | + public function preSave(\Propel\Runtime\Connection\ConnectionInterface $con = null) |
|
| 34 | + { |
|
| 35 | 35 | if (!$result = $this->validate($this->validator)) { |
| 36 | 36 | throw new ValidationException($this->getValidationFailures(),"Validation error"); |
| 37 | 37 | } |
| 38 | - return $result; |
|
| 39 | - } |
|
| 38 | + return $result; |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -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 | } |
@@ -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 | ; |