@@ -4,9 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Symfony\Component\HttpFoundation\Response; |
6 | 6 | use Twig_Environment; |
7 | -use Models\User\Base\UserQuery; |
|
8 | 7 | use Symfony\Component\VarDumper\VarDumper; |
9 | - |
|
10 | 8 | use Models\User\UserRepo; |
11 | 9 | |
12 | 10 | class IndexController |
@@ -62,18 +62,18 @@ |
||
62 | 62 | $i++; |
63 | 63 | } |
64 | 64 | |
65 | - return new Response($this->twig->render('pages/index.html.twig',[ |
|
65 | + return new Response($this->twig->render('pages/index.html.twig', [ |
|
66 | 66 | "table" => $table->render() |
67 | 67 | ])); |
68 | 68 | } |
69 | 69 | |
70 | - public function add($args){ |
|
70 | + public function add($args) { |
|
71 | 71 | |
72 | 72 | $User = $this->UserRepo->build(); |
73 | 73 | $User->setEmail('email.ru'); |
74 | 74 | //VarDumper::dump($User); |
75 | 75 | |
76 | - try{ |
|
76 | + try { |
|
77 | 77 | $this->UserRepo->save($User); |
78 | 78 | return new Response("success create!"); |
79 | 79 | } catch (\Exception $ex) { |
@@ -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() |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
739 | 739 | } |
740 | 740 | |
741 | - $con->transaction(function () use ($con) { |
|
741 | + $con->transaction(function() use ($con) { |
|
742 | 742 | $deleteQuery = ChildUserQuery::create() |
743 | 743 | ->filterByPrimaryKey($this->getPrimaryKey()); |
744 | 744 | $ret = $this->preDelete($con); |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
774 | 774 | } |
775 | 775 | |
776 | - return $con->transaction(function () use ($con) { |
|
776 | + return $con->transaction(function() use ($con) { |
|
777 | 777 | $isInsert = $this->isNew(); |
778 | 778 | $ret = $this->preSave($con); |
779 | 779 | if ($isInsert) { |
@@ -1396,13 +1396,13 @@ discard block |
||
1396 | 1396 | public function validate(ValidatorInterface $validator = null) |
1397 | 1397 | { |
1398 | 1398 | if (null === $validator) { |
1399 | - if(class_exists('Symfony\\Component\\Validator\\Validator\\LegacyValidator')){ |
|
1399 | + if (class_exists('Symfony\\Component\\Validator\\Validator\\LegacyValidator')) { |
|
1400 | 1400 | $validator = new LegacyValidator( |
1401 | 1401 | new ExecutionContextFactory(new DefaultTranslator()), |
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(), |
@@ -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(), |
@@ -68,7 +68,7 @@ |
||
68 | 68 | |
69 | 69 | /** |
70 | 70 | * |
71 | - * @return \Models\User\Models\User\User $User |
|
71 | + * @return User $User |
|
72 | 72 | */ |
73 | 73 | public function build(){ |
74 | 74 | return new User; |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace Models\User; |
4 | 4 | |
5 | 5 | use Propel\Runtime\ActiveRecord\ActiveRecordInterface; |
6 | - |
|
7 | 6 | use Models\User\User; |
8 | 7 | use Models\User\UserQuery; |
9 | 8 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function findById($id) |
30 | 30 | { |
31 | 31 | if (!$User = UserQuery::create()->findPk($id)) { |
32 | - throw new \InvalidArgumentException(sprintf('User with ID %d does not exist',$id)); |
|
32 | + throw new \InvalidArgumentException(sprintf('User with ID %d does not exist', $id)); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | return $User; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | |
62 | 62 | if (!$Model->save()) { |
63 | - throw new \DomainException(sprintf('User not save',$id)); |
|
63 | + throw new \DomainException(sprintf('User not save', $id)); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | return true; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return \Models\User\Models\User\User $User |
72 | 72 | */ |
73 | - public function build(){ |
|
73 | + public function build() { |
|
74 | 74 | return new User; |
75 | 75 | } |
76 | 76 |
@@ -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('rule5' => array ('column' => 'email','validator' => 'Email',), ), |
|
184 | + 'validate' => array('rule5' => array('column' => 'email', 'validator' => '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 | } |