From 9a0ac0a46810b8d7484be54c895c0e0b443280f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20F=C4=85fara?= Date: Tue, 3 Nov 2015 15:08:29 +0100 Subject: [PATCH 1/6] Allow using camelized namespaces for core tasks --- src/Cli/Loader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cli/Loader.php b/src/Cli/Loader.php index fb45b94..bf96daf 100644 --- a/src/Cli/Loader.php +++ b/src/Cli/Loader.php @@ -107,7 +107,7 @@ private function toNamespace($str) { $stringParts = preg_split('/_+/', $str); foreach($stringParts as $key => $stringPart){ - $stringParts[$key] = ucfirst(strtolower($stringPart)); + $stringParts[$key] = \Phalcon\Text::camelize($stringPart); } return implode('\\', $stringParts) . '\\'; } From 77f2fed2e1452a2255f699f2b2e793e795bd9235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20F=C4=85fara?= Date: Thu, 7 Jan 2016 09:39:59 +0100 Subject: [PATCH 2/6] Paginator hotfix: use GET params only for URL generating --- src/Tag/Pagination.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tag/Pagination.php b/src/Tag/Pagination.php index 0dbe3d0..afe80a0 100644 --- a/src/Tag/Pagination.php +++ b/src/Tag/Pagination.php @@ -177,7 +177,7 @@ private function renderElement($page, $title, $class = '') private function getUrlParams() { - $arguments = $this->di->get('request')->get(); + $arguments = $this->di->get('request')->getQuery(); unset($arguments['_url']); unset($arguments['page']); From d9cf247c686ad716b7ba39e72e79815621e73f69 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 18 Jul 2016 23:55:34 +0300 Subject: [PATCH 3/6] Cleaned FileWriter::write --- src/Util/FileWriter.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Util/FileWriter.php b/src/Util/FileWriter.php index 88b323c..7f285cb 100644 --- a/src/Util/FileWriter.php +++ b/src/Util/FileWriter.php @@ -32,10 +32,8 @@ class FileWriter */ public static function write($filePath, $content, $compareContents = false) { - if ($compareContents) { - if (self::compareContents($filePath, $content)) { - return 0; - } + if ($compareContents && self::compareContents($filePath, $content)) { + return 0; } return file_put_contents($filePath, $content); From 45afa783ba56313612f70be48691a0417f018d36 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 19 Jul 2016 01:09:14 +0300 Subject: [PATCH 4/6] Fixed dev dependencies Refs: https://github.com/vegas-cmf/core/pull/57 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6414fd6..61f0f89 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ }, "require-dev": { "phpunit/phpunit": "4.0.*", - "satooshi/php-coveralls": "dev-master", + "satooshi/php-coveralls": "^1.0", "ext-mongo": ">=1.5" }, "autoload": { From 99d0f0f3d02658d44eb882e444353f8a169f1c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20F=C4=85fara?= Date: Tue, 19 Jul 2016 11:32:53 +0200 Subject: [PATCH 5/6] Fixed Pagination mock, restored 5.4 PHP requirement in Travis config --- .travis.yml | 2 +- tests/Tag/PaginationTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9d845f1..9839451 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: php php: - - 5.6 + - 5.4 services: - mongodb diff --git a/tests/Tag/PaginationTest.php b/tests/Tag/PaginationTest.php index bfd57a4..003cf41 100644 --- a/tests/Tag/PaginationTest.php +++ b/tests/Tag/PaginationTest.php @@ -19,7 +19,7 @@ class RequestMock { - public function get() + public function getQuery() { return [ 'by' => 'name', From 0c346a677ed3936a4b85776cabdd606a9449722f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20F=C4=85fara?= Date: Thu, 11 Aug 2016 18:17:49 +0200 Subject: [PATCH 6/6] Allow ServiceManager to provide custom __construct() parameters when resolving service --- src/DI/ServiceManager.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/DI/ServiceManager.php b/src/DI/ServiceManager.php index 5fca59f..9b0ffcc 100644 --- a/src/DI/ServiceManager.php +++ b/src/DI/ServiceManager.php @@ -10,6 +10,8 @@ * $this->serviceManager->getService('foo:barBaz'); * // or in view * {{ serviceManager.getService('foo:barBaz') }} + * // or using extra params for __construct() + * {{ serviceManager.getService('foo:barBaz', ['param1', 'param2']) }} * * * @author Arkadiusz Ostrycharz @@ -35,28 +37,30 @@ class ServiceManager implements InjectionAwareInterface /** * Alias for getService. * - * @param $name + * @param string $name + * @param array $parameters * @return object */ - public function get($name) + public function get($name, array $parameters = []) { - return $this->getService($name); + return $this->getService($name, $parameters); } /** * Try to register and return service. * - * @param $name + * @param string $name + * @param array $parameters * @return object * @throws Service\Exception */ - public function getService($name) + public function getService($name, array $parameters = []) { try { if (!$this->isRegisteredService($name)) { $this->registerService($name); } - return $this->di->get($name); + return $this->di->get($name, $parameters); } catch (\Phalcon\DI\Exception $ex) { throw new Exception($ex->getMessage().', using: '.$name); }