@@ -13,28 +13,28 @@ |
||
13 | 13 | class InstallPackagesCommand extends Command{ |
14 | 14 | |
15 | 15 | protected function configure(){ |
16 | - $this->setName('packages:install') |
|
17 | - ->setDescription('Install packages migration and assets'); |
|
16 | + $this->setName('packages:install') |
|
17 | + ->setDescription('Install packages migration and assets'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | protected function execute(InputInterface $input, OutputInterface $output){ |
21 | - $finder = \Symfony\Component\Finder\Finder::create(); |
|
21 | + $finder = \Symfony\Component\Finder\Finder::create(); |
|
22 | 22 | |
23 | - $root_path = __DIR__ . "../../../.."; |
|
23 | + $root_path = __DIR__ . "../../../.."; |
|
24 | 24 | |
25 | - $iterator = $finder |
|
26 | - ->files() |
|
27 | - ->in($root_path . "/vendor/*/*/db"); |
|
25 | + $iterator = $finder |
|
26 | + ->files() |
|
27 | + ->in($root_path . "/vendor/*/*/db"); |
|
28 | 28 | |
29 | - foreach($iterator as $file){ |
|
29 | + foreach($iterator as $file){ |
|
30 | 30 | |
31 | - if(!copy($file->getRealpath(), $root_path . '/db/' . $file->getRelativePathname())){ |
|
32 | - $output->writeln(sprintf("error copy migration %s...", $file->getRelativePathname())); |
|
33 | - } else{ |
|
34 | - $output->writeln(sprintf("copy migration %s", $file->getRelativePathname())); |
|
35 | - } |
|
36 | - } |
|
31 | + if(!copy($file->getRealpath(), $root_path . '/db/' . $file->getRelativePathname())){ |
|
32 | + $output->writeln(sprintf("error copy migration %s...", $file->getRelativePathname())); |
|
33 | + } else{ |
|
34 | + $output->writeln(sprintf("copy migration %s", $file->getRelativePathname())); |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | - $output->writeln("completed!"); |
|
38 | + $output->writeln("completed!"); |
|
39 | 39 | } |
40 | 40 | } |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | * |
11 | 11 | * @author Dmitriy |
12 | 12 | */ |
13 | -class InstallPackagesCommand extends Command{ |
|
13 | +class InstallPackagesCommand extends Command { |
|
14 | 14 | |
15 | - protected function configure(){ |
|
15 | + protected function configure() { |
|
16 | 16 | $this->setName('packages:install') |
17 | 17 | ->setDescription('Install packages migration and assets'); |
18 | 18 | } |
19 | 19 | |
20 | - protected function execute(InputInterface $input, OutputInterface $output){ |
|
20 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
21 | 21 | $finder = \Symfony\Component\Finder\Finder::create(); |
22 | 22 | |
23 | 23 | $root_path = __DIR__ . "../../../.."; |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | ->files() |
27 | 27 | ->in($root_path . "/vendor/*/*/db"); |
28 | 28 | |
29 | - foreach($iterator as $file){ |
|
29 | + foreach ($iterator as $file) { |
|
30 | 30 | |
31 | - if(!copy($file->getRealpath(), $root_path . '/db/' . $file->getRelativePathname())){ |
|
31 | + if (!copy($file->getRealpath(), $root_path . '/db/' . $file->getRelativePathname())) { |
|
32 | 32 | $output->writeln(sprintf("error copy migration %s...", $file->getRelativePathname())); |
33 | - } else{ |
|
33 | + } else { |
|
34 | 34 | $output->writeln(sprintf("copy migration %s", $file->getRelativePathname())); |
35 | 35 | } |
36 | 36 | } |
@@ -16,25 +16,25 @@ |
||
16 | 16 | class SeedBuildCommand extends Command{ |
17 | 17 | |
18 | 18 | protected function configure(){ |
19 | - $this->setName('seed:build') |
|
20 | - ->setDescription('Create seeds data') |
|
21 | - ->setDefinition( |
|
22 | - new InputDefinition(array( |
|
23 | - new InputOption('class', 'c', InputOption::VALUE_REQUIRED), |
|
24 | - new InputOption('amount', 'a', InputOption::VALUE_OPTIONAL) |
|
25 | - )) |
|
26 | - ); |
|
19 | + $this->setName('seed:build') |
|
20 | + ->setDescription('Create seeds data') |
|
21 | + ->setDefinition( |
|
22 | + new InputDefinition(array( |
|
23 | + new InputOption('class', 'c', InputOption::VALUE_REQUIRED), |
|
24 | + new InputOption('amount', 'a', InputOption::VALUE_OPTIONAL) |
|
25 | + )) |
|
26 | + ); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | protected function execute(InputInterface $input, OutputInterface $output){ |
30 | 30 | |
31 | - if(!$class = $input->getOption('class')){ |
|
32 | - $output->writeln("Class Model not set"); |
|
33 | - return; |
|
34 | - } |
|
31 | + if(!$class = $input->getOption('class')){ |
|
32 | + $output->writeln("Class Model not set"); |
|
33 | + return; |
|
34 | + } |
|
35 | 35 | |
36 | - $number = $input->getOption('amount'); |
|
37 | - $class::build($number > 1 ? $number : 1); |
|
38 | - $output->writeln(sprintf("Seed %s amount %s create success!", $class, $number)); |
|
36 | + $number = $input->getOption('amount'); |
|
37 | + $class::build($number > 1 ? $number : 1); |
|
38 | + $output->writeln(sprintf("Seed %s amount %s create success!", $class, $number)); |
|
39 | 39 | } |
40 | 40 | } |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @author Dmitriy |
15 | 15 | */ |
16 | -class SeedBuildCommand extends Command{ |
|
16 | +class SeedBuildCommand extends Command { |
|
17 | 17 | |
18 | - protected function configure(){ |
|
18 | + protected function configure() { |
|
19 | 19 | $this->setName('seed:build') |
20 | 20 | ->setDescription('Create seeds data') |
21 | 21 | ->setDefinition( |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | ); |
27 | 27 | } |
28 | 28 | |
29 | - protected function execute(InputInterface $input, OutputInterface $output){ |
|
29 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
30 | 30 | |
31 | - if(!$class = $input->getOption('class')){ |
|
31 | + if (!$class = $input->getOption('class')) { |
|
32 | 32 | $output->writeln("Class Model not set"); |
33 | 33 | return; |
34 | 34 | } |
@@ -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(); |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * |
7 | 7 | * @author d.lanec |
8 | 8 | */ |
9 | -interface ModuleInterface{ |
|
9 | +interface ModuleInterface { |
|
10 | 10 | |
11 | 11 | public function process(); |
12 | 12 |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * |
7 | 7 | * @author Dmitriy |
8 | 8 | */ |
9 | -interface SeedInterface{ |
|
9 | +interface SeedInterface { |
|
10 | 10 | |
11 | 11 | static public function build($id = 1); |
12 | 12 |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | * @return type |
15 | 15 | */ |
16 | 16 | static public function build($id = 1){ |
17 | - $generator = \Faker\Factory::create(); |
|
18 | - $populator = new \Faker\ORM\Propel2\Populator($generator); |
|
19 | - $populator->addEntity(\Core\Models\User\User::class, $id); |
|
20 | - return $populator->execute(); |
|
17 | + $generator = \Faker\Factory::create(); |
|
18 | + $populator = new \Faker\ORM\Propel2\Populator($generator); |
|
19 | + $populator->addEntity(\Core\Models\User\User::class, $id); |
|
20 | + return $populator->execute(); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -25,6 +25,6 @@ discard block |
||
25 | 25 | * @return type |
26 | 26 | */ |
27 | 27 | public static function reset(){ |
28 | - return \Core\Models\User\UserQuery::create()->deleteAll(); |
|
28 | + return \Core\Models\User\UserQuery::create()->deleteAll(); |
|
29 | 29 | } |
30 | 30 | } |
@@ -6,14 +6,14 @@ discard block |
||
6 | 6 | * |
7 | 7 | * @author Dmitriy |
8 | 8 | */ |
9 | -class User implements \Frameworkless\SeedInterface{ |
|
9 | +class User implements \Frameworkless\SeedInterface { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * |
13 | 13 | * @param type $id |
14 | 14 | * @return type |
15 | 15 | */ |
16 | - static public function build($id = 1){ |
|
16 | + static public function build($id = 1) { |
|
17 | 17 | $generator = \Faker\Factory::create(); |
18 | 18 | $populator = new \Faker\ORM\Propel2\Populator($generator); |
19 | 19 | $populator->addEntity(\Core\Models\User\User::class, $id); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return type |
26 | 26 | */ |
27 | - public static function reset(){ |
|
27 | + public static function reset() { |
|
28 | 28 | return \Core\Models\User\UserQuery::create()->deleteAll(); |
29 | 29 | } |
30 | 30 | } |
@@ -8,12 +8,12 @@ |
||
8 | 8 | * |
9 | 9 | * @author Dmitriy |
10 | 10 | */ |
11 | -class ServiceProvider extends AbstractServiceProvider{ |
|
11 | +class ServiceProvider extends AbstractServiceProvider { |
|
12 | 12 | |
13 | 13 | protected $provides = [ |
14 | 14 | ]; |
15 | 15 | |
16 | - public function register(){ |
|
16 | + public function register() { |
|
17 | 17 | |
18 | 18 | } |
19 | 19 | } |
@@ -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 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | class UserRepository implements \Frameworkless\CrudInterface{ |
13 | 13 | |
14 | 14 | public function find(array $conditions = []){ |
15 | - return UserQuery::create()->findOneByArray($conditions); |
|
15 | + return UserQuery::create()->findOneByArray($conditions); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
@@ -22,24 +22,24 @@ discard block |
||
22 | 22 | * @throws \InvalidArgumentException |
23 | 23 | */ |
24 | 24 | public function findById($id){ |
25 | - if(!$User = UserQuery::create()->findPk($id)){ |
|
26 | - throw new \InvalidArgumentException(sprintf('User with ID %d does not exist', $id)); |
|
27 | - } |
|
25 | + if(!$User = UserQuery::create()->findPk($id)){ |
|
26 | + throw new \InvalidArgumentException(sprintf('User with ID %d does not exist', $id)); |
|
27 | + } |
|
28 | 28 | |
29 | - return $User; |
|
29 | + return $User; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function findMany(array $conditions = [], $limit = false){ |
33 | - $Users = UserQuery::create() |
|
34 | - ->_if($limit) |
|
35 | - ->limit($limit) |
|
36 | - ->_endif() |
|
37 | - ->findByArray($conditions); |
|
38 | - return $Users; |
|
33 | + $Users = UserQuery::create() |
|
34 | + ->_if($limit) |
|
35 | + ->limit($limit) |
|
36 | + ->_endif() |
|
37 | + ->findByArray($conditions); |
|
38 | + return $Users; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function delete(ActiveRecordInterface $Model){ |
42 | - return $Model->delete(); |
|
42 | + return $Model->delete(); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @throws \DomainException |
50 | 50 | */ |
51 | 51 | public function save(ActiveRecordInterface $Model){ |
52 | - return $Model->save(); |
|
52 | + return $Model->save(); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -57,6 +57,6 @@ discard block |
||
57 | 57 | * @return \Core\Models\User\User $User |
58 | 58 | */ |
59 | 59 | public function build(){ |
60 | - return new User; |
|
60 | + return new User; |
|
61 | 61 | } |
62 | 62 | } |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | * |
10 | 10 | * @author Dmitriy |
11 | 11 | */ |
12 | -class UserRepository implements \Frameworkless\CrudInterface{ |
|
12 | +class UserRepository implements \Frameworkless\CrudInterface { |
|
13 | 13 | |
14 | - public function find(array $conditions = []){ |
|
14 | + public function find(array $conditions = []) { |
|
15 | 15 | return UserQuery::create()->findOneByArray($conditions); |
16 | 16 | } |
17 | 17 | |
@@ -21,15 +21,15 @@ discard block |
||
21 | 21 | * @return \Models\User\User $User |
22 | 22 | * @throws \InvalidArgumentException |
23 | 23 | */ |
24 | - public function findById($id){ |
|
25 | - if(!$User = UserQuery::create()->findPk($id)){ |
|
24 | + public function findById($id) { |
|
25 | + if (!$User = UserQuery::create()->findPk($id)) { |
|
26 | 26 | throw new \InvalidArgumentException(sprintf('User with ID %d does not exist', $id)); |
27 | 27 | } |
28 | 28 | |
29 | 29 | return $User; |
30 | 30 | } |
31 | 31 | |
32 | - public function findMany(array $conditions = [], $limit = false){ |
|
32 | + public function findMany(array $conditions = [], $limit = false) { |
|
33 | 33 | $Users = UserQuery::create() |
34 | 34 | ->_if($limit) |
35 | 35 | ->limit($limit) |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | return $Users; |
39 | 39 | } |
40 | 40 | |
41 | - public function delete(ActiveRecordInterface $Model){ |
|
41 | + public function delete(ActiveRecordInterface $Model) { |
|
42 | 42 | return $Model->delete(); |
43 | 43 | } |
44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @return boolean |
49 | 49 | * @throws \DomainException |
50 | 50 | */ |
51 | - public function save(ActiveRecordInterface $Model){ |
|
51 | + public function save(ActiveRecordInterface $Model) { |
|
52 | 52 | return $Model->save(); |
53 | 53 | } |
54 | 54 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return \Core\Models\User\User $User |
58 | 58 | */ |
59 | - public function build(){ |
|
59 | + public function build() { |
|
60 | 60 | return new User; |
61 | 61 | } |
62 | 62 | } |