Completed
Push — master ( 76c71b...91372c )
by dima
05:24
created
app/Controllers/IndexController.php 3 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,6 @@  discard block
 block discarded – undo
17 17
 	/**
18 18
 	 * IndexController, constructed by container
19 19
 	 *
20
-	 * @param Twig_Environment $twig
21 20
 	 */
22 21
 	public function __construct( UserList $userListModule) {
23 22
 
@@ -28,7 +27,7 @@  discard block
 block discarded – undo
28 27
 	 * Return index page (/)
29 28
 	 *
30 29
 	 * @param array $args
31
-	 * @return Response
30
+	 * @return \Symfony\Component\HttpFoundation\Response
32 31
 	 */
33 32
 	public function get($args) {
34 33
 		return $this->render('pages/index.html.twig', [
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -6,34 +6,34 @@
 block discarded – undo
6 6
 
7 7
 class IndexController extends BaseController {
8 8
 	
9
-	/**
10
-	 *
11
-	 * @var \Models\User\UserRepository $UserRepository
12
-	 */
13
-	protected $UserRepository;
14
-
15
-	protected $userListModule;
16
-
17
-	/**
18
-	 * IndexController, constructed by container
19
-	 *
20
-	 * @param Twig_Environment $twig
21
-	 */
22
-	public function __construct( UserList $userListModule) {
23
-
24
-		$this->userListModule = $userListModule;
25
-	}
26
-
27
-	/**
28
-	 * Return index page (/)
29
-	 *
30
-	 * @param array $args
31
-	 * @return Response
32
-	 */
33
-	public function get($args) {
34
-		return $this->render('pages/index.html.twig', [
35
-				"content" => $this->userListModule->process($args),
36
-		]);
37
-	}
9
+    /**
10
+     *
11
+     * @var \Models\User\UserRepository $UserRepository
12
+     */
13
+    protected $UserRepository;
14
+
15
+    protected $userListModule;
16
+
17
+    /**
18
+     * IndexController, constructed by container
19
+     *
20
+     * @param Twig_Environment $twig
21
+     */
22
+    public function __construct( UserList $userListModule) {
23
+
24
+        $this->userListModule = $userListModule;
25
+    }
26
+
27
+    /**
28
+     * Return index page (/)
29
+     *
30
+     * @param array $args
31
+     * @return Response
32
+     */
33
+    public function get($args) {
34
+        return $this->render('pages/index.html.twig', [
35
+                "content" => $this->userListModule->process($args),
36
+        ]);
37
+    }
38 38
 
39 39
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 	 *
20 20
 	 * @param Twig_Environment $twig
21 21
 	 */
22
-	public function __construct( UserList $userListModule) {
22
+	public function __construct(UserList $userListModule) {
23 23
 
24 24
 		$this->userListModule = $userListModule;
25 25
 	}
Please login to merge, or discard this patch.
packages/core/src/Modules/UserList/UserList.php 3 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Core\Modules\UserList;
3 3
 
4
-use Frameworkless\Controllers;
4
+use Frameworkless\Controllers;
5 5
 use Donquixote\Cellbrush\Table\Table;
6 6
 
7 7
 /**
Please login to merge, or discard this patch.
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -12,76 +12,76 @@
 block discarded – undo
12 12
 class UserList extends Controllers\ModuleController implements Controllers\ModuleInterface
13 13
 {
14 14
 
15
-	/**
16
-	 *
17
-	 * @var \Core\Models\User\UserRepository 
18
-	 */
19
-	protected $userRepository;
20
-
21
-	function __construct(\Core\Models\User\UserRepository $userRepository)
22
-	{
23
-		$this->userRepository = $userRepository;
24
-	}
25
-
26
-	public function process($args = [])
27
-	{
28
-
29
-		$this->logger->debug('UserList start');
30
-
31
-		if ($args['fn'] == 'add') {
32
-			$this->add();
33
-		}
34
-
35
-		$Users = $this->userRepository->findMany();
36
-
37
-		$table	 = Table::create();
38
-		$table->addColNames([0, 1, 2]);
39
-		$table->addClass('table table-striped');
40
-		$table->thead()
41
-				->addRowName('head row')
42
-				->th('head row', 0, 'Id')
43
-				->th('head row', 1, 'Имя')
44
-				->th('head row', 2, 'Email');
45
-		$i		 = 0;
46
-		foreach ($Users as $User) {
47
-			$table->addRow($i)->tdMultiple([
48
-				$User->getId(),
49
-				$User->getName(),
50
-				$User->getEmail()]);
51
-			$i++;
52
-		}
53
-
54
-		return $this->render('default', [
55
-					'table' => $table->render()
56
-		]);
57
-	}
58
-
59
-	protected function add()
60
-	{
61
-
62
-		try {
63
-
64
-			$User = $this->userRepository->build();
65
-			$User->setEmail('[email protected]');
66
-
67
-			if (!$this->UserRepository->save($User)) {
68
-				throw new Exception('User not save');
69
-			} else {
70
-				$this->logger->info("Пользователь успешно сохранен!");
71
-			}
72
-		} catch(\Frameworkless\Exceptions\ValidationException $ex) {
73
-
74
-			foreach ($ex->getFailures() as $failure) {
75
-				$this->logger->error("Property " . $failure->getPropertyPath() . ": " . $failure->getMessage() . "\n");
76
-			}
77
-
78
-			$this->logger->info("Произошла ошибка при сохранении пользователя");
79
-		} catch(\Exception $ex) {
80
-
81
-			$this->logger->error("system error:" . $ex->getMessage());
82
-
83
-			$this->logger->info("Произошла ошибка при сохранении пользователя");
84
-		}
85
-
86
-	}
15
+    /**
16
+     *
17
+     * @var \Core\Models\User\UserRepository 
18
+     */
19
+    protected $userRepository;
20
+
21
+    function __construct(\Core\Models\User\UserRepository $userRepository)
22
+    {
23
+        $this->userRepository = $userRepository;
24
+    }
25
+
26
+    public function process($args = [])
27
+    {
28
+
29
+        $this->logger->debug('UserList start');
30
+
31
+        if ($args['fn'] == 'add') {
32
+            $this->add();
33
+        }
34
+
35
+        $Users = $this->userRepository->findMany();
36
+
37
+        $table	 = Table::create();
38
+        $table->addColNames([0, 1, 2]);
39
+        $table->addClass('table table-striped');
40
+        $table->thead()
41
+                ->addRowName('head row')
42
+                ->th('head row', 0, 'Id')
43
+                ->th('head row', 1, 'Имя')
44
+                ->th('head row', 2, 'Email');
45
+        $i		 = 0;
46
+        foreach ($Users as $User) {
47
+            $table->addRow($i)->tdMultiple([
48
+                $User->getId(),
49
+                $User->getName(),
50
+                $User->getEmail()]);
51
+            $i++;
52
+        }
53
+
54
+        return $this->render('default', [
55
+                    'table' => $table->render()
56
+        ]);
57
+    }
58
+
59
+    protected function add()
60
+    {
61
+
62
+        try {
63
+
64
+            $User = $this->userRepository->build();
65
+            $User->setEmail('[email protected]');
66
+
67
+            if (!$this->UserRepository->save($User)) {
68
+                throw new Exception('User not save');
69
+            } else {
70
+                $this->logger->info("Пользователь успешно сохранен!");
71
+            }
72
+        } catch(\Frameworkless\Exceptions\ValidationException $ex) {
73
+
74
+            foreach ($ex->getFailures() as $failure) {
75
+                $this->logger->error("Property " . $failure->getPropertyPath() . ": " . $failure->getMessage() . "\n");
76
+            }
77
+
78
+            $this->logger->info("Произошла ошибка при сохранении пользователя");
79
+        } catch(\Exception $ex) {
80
+
81
+            $this->logger->error("system error:" . $ex->getMessage());
82
+
83
+            $this->logger->info("Произошла ошибка при сохранении пользователя");
84
+        }
85
+
86
+    }
87 87
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 		$Users = $this->userRepository->findMany();
36 36
 
37
-		$table	 = Table::create();
37
+		$table = Table::create();
38 38
 		$table->addColNames([0, 1, 2]);
39 39
 		$table->addClass('table table-striped');
40 40
 		$table->thead()
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 				->th('head row', 0, 'Id')
43 43
 				->th('head row', 1, 'Имя')
44 44
 				->th('head row', 2, 'Email');
45
-		$i		 = 0;
45
+		$i = 0;
46 46
 		foreach ($Users as $User) {
47 47
 			$table->addRow($i)->tdMultiple([
48 48
 				$User->getId(),
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 			} else {
70 70
 				$this->logger->info("Пользователь успешно сохранен!");
71 71
 			}
72
-		} catch(\Frameworkless\Exceptions\ValidationException $ex) {
72
+		} catch (\Frameworkless\Exceptions\ValidationException $ex) {
73 73
 
74 74
 			foreach ($ex->getFailures() as $failure) {
75 75
 				$this->logger->error("Property " . $failure->getPropertyPath() . ": " . $failure->getMessage() . "\n");
76 76
 			}
77 77
 
78 78
 			$this->logger->info("Произошла ошибка при сохранении пользователя");
79
-		} catch(\Exception $ex) {
79
+		} catch (\Exception $ex) {
80 80
 
81 81
 			$this->logger->error("system error:" . $ex->getMessage());
82 82
 
Please login to merge, or discard this patch.
packages/core/src/Models/User/Map/UserTableMap.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
181 181
     public function getBehaviors()
182 182
     {
183 183
         return array(
184
-            'validate' => array('rule1' => array ('column' => 'email','validator' => 'Email',), ),
184
+            'validate' => array('rule1' => array('column' => 'email', 'validator' => 'Email',),),
185 185
         );
186 186
     } // getBehaviors()
187 187
 
@@ -440,8 +440,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.