Commit 74a8a4f0 authored by Franco Fichtner's avatar Franco Fichtner

mvc: style sweep

parent 2e31042e
...@@ -167,7 +167,9 @@ abstract class ApiMutableModelControllerBase extends ApiControllerBase ...@@ -167,7 +167,9 @@ abstract class ApiMutableModelControllerBase extends ApiControllerBase
* @param $mdl The validated model containing the new state of the model * @param $mdl The validated model containing the new state of the model
* @return Error message on error, or null/void on success * @return Error message on error, or null/void on success
*/ */
protected function setActionHook() { } protected function setActionHook()
{
}
/** /**
* update model settings * update model settings
......
...@@ -39,11 +39,13 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl ...@@ -39,11 +39,13 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl
static protected $modelPathPrefix = ''; static protected $modelPathPrefix = '';
static protected $gridFields = array(); static protected $gridFields = array();
static protected $gridDefaultSort = null; static protected $gridDefaultSort = null;
private function getNodes() { private function getNodes()
{
$ref = static::$modelPathPrefix . static::$internalModelName; $ref = static::$modelPathPrefix . static::$internalModelName;
return $this->getModel()->getNodeByReference($ref); return $this->getModel()->getNodeByReference($ref);
} }
private function getNodeByUUID($uuid) { private function getNodeByUUID($uuid)
{
$nodes = $this->getNodes(); $nodes = $this->getNodes();
return !empty($nodes) ? $nodes->$uuid : null; return !empty($nodes) ? $nodes->$uuid : null;
} }
...@@ -78,7 +80,9 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl ...@@ -78,7 +80,9 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl
* @param $mdl The validated model containing the new state of the model * @param $mdl The validated model containing the new state of the model
* @return Error message on error, or null/void on success * @return Error message on error, or null/void on success
*/ */
protected function setItemActionHook($mdl) { } protected function setItemActionHook($mdl)
{
}
/** /**
* update item with given properties * update item with given properties
...@@ -108,7 +112,9 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl ...@@ -108,7 +112,9 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl
* @param $mdl The validated model containing the state of the new model * @param $mdl The validated model containing the state of the new model
* @return Error message on error, or null/void on success * @return Error message on error, or null/void on success
*/ */
protected function addItemActionHook($mdl) { } protected function addItemActionHook($mdl)
{
}
/** /**
* add new item and set with attributes from post * add new item and set with attributes from post
...@@ -134,7 +140,9 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl ...@@ -134,7 +140,9 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl
* @param $uuid The UUID of the item to be deleted * @param $uuid The UUID of the item to be deleted
* @return Error message on error, or null/void on succes s * @return Error message on error, or null/void on succes s
*/ */
protected function delItemActionHook($uuid) { } protected function delItemActionHook($uuid)
{
}
/** /**
* delete item by uuid * delete item by uuid
...@@ -150,7 +158,7 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl ...@@ -150,7 +158,7 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl
$errorMessage = delItemActionHook($uuid); $errorMessage = delItemActionHook($uuid);
if ($errorMessage) { if ($errorMessage) {
$result['error'] = $errorMessage; $result['error'] = $errorMessage;
} else if (getNodes()->del($uuid)) { } elseif (getNodes()->del($uuid)) {
// if item is removed, serialize to config and save // if item is removed, serialize to config and save
$mdl->serializeToConfig(); $mdl->serializeToConfig();
Config::getInstance()->save(); Config::getInstance()->save();
...@@ -172,7 +180,9 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl ...@@ -172,7 +180,9 @@ abstract class ApiMutableTableModelControllerBase extends ApiMutableModelControl
* @param $enabled desired state enabled(1)/disabled(1), leave empty for toggle * @param $enabled desired state enabled(1)/disabled(1), leave empty for toggle
* @return Error message on error, or null/void on succes s * @return Error message on error, or null/void on succes s
*/ */
protected function toggleItemActionHook($uuid, $enabled) { } protected function toggleItemActionHook($uuid, $enabled)
{
}
/** /**
* toggle item by uuid (enable/disable) * toggle item by uuid (enable/disable)
......
...@@ -526,7 +526,7 @@ abstract class BaseModel ...@@ -526,7 +526,7 @@ abstract class BaseModel
// fetch version migrations // fetch version migrations
$versions = array(); $versions = array();
foreach (glob(dirname($class_info->getFileName())."/migrations/M*.php") as $filename) { foreach (glob(dirname($class_info->getFileName())."/migrations/M*.php") as $filename) {
$version = str_replace('_', '.', explode('.', substr(basename($filename),1))[0]); $version = str_replace('_', '.', explode('.', substr(basename($filename), 1))[0]);
$versions[$version] = $filename; $versions[$version] = $filename;
} }
uksort($versions, "version_compare"); uksort($versions, "version_compare");
...@@ -546,8 +546,7 @@ abstract class BaseModel ...@@ -546,8 +546,7 @@ abstract class BaseModel
$this->internal_current_model_version . $this->internal_current_model_version .
" to " . $mig_version . " in ". " to " . $mig_version . " in ".
$class_info->getName() . $class_info->getName() .
" [skipping step]" " [skipping step]");
);
} }
$this->internal_current_model_version = $mig_version; $this->internal_current_model_version = $mig_version;
} }
......
...@@ -37,5 +37,7 @@ use Phalcon\Logger\Adapter\Syslog; ...@@ -37,5 +37,7 @@ use Phalcon\Logger\Adapter\Syslog;
*/ */
abstract class BaseModelMigration abstract class BaseModelMigration
{ {
public function run($model) {} public function run($model)
{
}
} }
...@@ -38,4 +38,4 @@ class M0_0_1 extends BaseModelMigration ...@@ -38,4 +38,4 @@ class M0_0_1 extends BaseModelMigration
$current_value = (string)$model->general->FromEmail; $current_value = (string)$model->general->FromEmail;
$model->general->FromEmail = "001_" . $current_value; $model->general->FromEmail = "001_" . $current_value;
} }
} }
\ No newline at end of file
...@@ -38,4 +38,4 @@ class M1_0_0 extends BaseModelMigration ...@@ -38,4 +38,4 @@ class M1_0_0 extends BaseModelMigration
$current_value = (string)$model->general->FromEmail; $current_value = (string)$model->general->FromEmail;
$model->general->FromEmail = "100_" . $current_value; $model->general->FromEmail = "100_" . $current_value;
} }
} }
\ No newline at end of file
...@@ -38,4 +38,4 @@ class M1_0_1 extends BaseModelMigration ...@@ -38,4 +38,4 @@ class M1_0_1 extends BaseModelMigration
$current_value = (string)$model->general->FromEmail; $current_value = (string)$model->general->FromEmail;
$model->general->FromEmail = "101_" . $current_value; $model->general->FromEmail = "101_" . $current_value;
} }
} }
\ No newline at end of file
...@@ -234,5 +234,4 @@ class BaseModelTest extends \PHPUnit_Framework_TestCase ...@@ -234,5 +234,4 @@ class BaseModelTest extends \PHPUnit_Framework_TestCase
$data = BaseModelTest::$model->arraytypes->item->getNodes(); $data = BaseModelTest::$model->arraytypes->item->getNodes();
$this->assertEquals(count($data), 9); $this->assertEquals(count($data), 9);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment