@@ -10,7 +10,7 @@ |
||
| 10 | 10 | // created by an earlier cms migration so always appears if the |
| 11 | 11 | // migration creation order is not adhered to. |
| 12 | 12 | $connection = neon()->db; |
| 13 | -$sql =<<<EOQ |
|
| 13 | +$sql = <<<EOQ |
|
| 14 | 14 | SET foreign_key_checks = 0; |
| 15 | 15 | DROP TABLE IF EXISTS `ddt_cms_static_content`; |
| 16 | 16 | DELETE FROM `dds_member` WHERE `class_type`='cms_static_content'; |
@@ -7,23 +7,23 @@ |
||
| 7 | 7 | |
| 8 | 8 | class m170112_201653_cms_static_content_page_ids_to_uuid64 extends Migration |
| 9 | 9 | { |
| 10 | - public function safeUp() |
|
| 11 | - { |
|
| 12 | - $cms_static_content = CmsStaticContent::tableName(); |
|
| 10 | + public function safeUp() |
|
| 11 | + { |
|
| 12 | + $cms_static_content = CmsStaticContent::tableName(); |
|
| 13 | 13 | $cms_page = CmsPage::tableName(); |
| 14 | 14 | |
| 15 | 15 | // use a nice id |
| 16 | - $this->alterColumn($cms_static_content, 'page_id', $this->char(22)->null()->comment('A uuid using base 64')); |
|
| 16 | + $this->alterColumn($cms_static_content, 'page_id', $this->char(22)->null()->comment('A uuid using base 64')); |
|
| 17 | 17 | // update with nice_id's |
| 18 | 18 | $this->execute("UPDATE $cms_static_content JOIN $cms_page ON $cms_page.old_id = $cms_static_content.page_id SET $cms_static_content.page_id = $cms_page.id"); |
| 19 | - } |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public function safeDown() |
|
| 22 | - { |
|
| 21 | + public function safeDown() |
|
| 22 | + { |
|
| 23 | 23 | $cms_static_content = CmsStaticContent::tableName(); |
| 24 | 24 | $cms_page = CmsPage::tableName(); |
| 25 | 25 | |
| 26 | 26 | $this->execute("UPDATE $cms_static_content JOIN $cms_page ON $cms_page.id = $cms_static_content.page_id SET $cms_static_content.page_id = $cms_page.old_id"); |
| 27 | 27 | $this->alterColumn($cms_static_content, 'page_id', $this->integer(11)->null()); |
| 28 | - } |
|
| 28 | + } |
|
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |
@@ -5,20 +5,20 @@ |
||
| 5 | 5 | class m161130_180814_cms_additional_page_fields extends Migration |
| 6 | 6 | { |
| 7 | 7 | |
| 8 | - public function safeUp() |
|
| 9 | - { |
|
| 8 | + public function safeUp() |
|
| 9 | + { |
|
| 10 | 10 | $this->addColumn('cms_page', 'keywords', "VARCHAR(1000) NULL COMMENT 'Keywords for this page'"); |
| 11 | 11 | $this->addColumn('cms_page', 'description', "VARCHAR(1000) NULL COMMENT 'Description of this page'"); |
| 12 | 12 | $this->addColumn('cms_page', 'languages', "VARCHAR(1000) NULL COMMENT 'Supported languages on this page'"); |
| 13 | 13 | $this->addColumn('cms_page', 'page_params', "VARCHAR(10000) NULL COMMENT 'Additional parameters for this page which are interpreted directly within the templates'"); |
| 14 | - } |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - public function safeDown() |
|
| 17 | - { |
|
| 16 | + public function safeDown() |
|
| 17 | + { |
|
| 18 | 18 | $this->dropColumn('cms_page', 'keywords'); |
| 19 | 19 | $this->dropColumn('cms_page', 'description'); |
| 20 | 20 | $this->dropColumn('cms_page', 'languages'); |
| 21 | 21 | $this->dropColumn('cms_page', 'page_params'); |
| 22 | - } |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | 24 | } |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | class m170107_201653_cms_create_cms_static_content_table_again extends Migration |
| 6 | 6 | { |
| 7 | - public function safeUp() |
|
| 8 | - { |
|
| 7 | + public function safeUp() |
|
| 8 | + { |
|
| 9 | 9 | $cms_static = 'cms_static_content'; |
| 10 | 10 | |
| 11 | 11 | // recreate the table with the new structure |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | // } |
| 47 | 47 | // } |
| 48 | 48 | // } while ($count < $total); |
| 49 | - } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - public function safeDown() |
|
| 52 | - { |
|
| 51 | + public function safeDown() |
|
| 52 | + { |
|
| 53 | 53 | $this->dropTable('cms_static_content'); |
| 54 | - } |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | // recreate the table with the new structure |
| 12 | 12 | $this->execute("DROP TABLE IF EXISTS $cms_static"); |
| 13 | - $sql =<<<EOQ |
|
| 13 | + $sql = <<<EOQ |
|
| 14 | 14 | CREATE TABLE IF NOT EXISTS `cms_static_content` ( |
| 15 | 15 | `key` varchar(100) NOT NULL COMMENT 'a key to access the content' COLLATE utf8mb4_unicode_ci, |
| 16 | 16 | `page_id` INT UNSIGNED NULL COMMENT 'if provided, restrict content to the associated page', |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | $connection = \Yii::$app->getDb(); |
| 16 | 16 | |
| 17 | 17 | // create the various tables for dds |
| 18 | - $sql=<<<EOQ |
|
| 18 | + $sql = <<<EOQ |
|
| 19 | 19 | -- -------------------------------------------------------- |
| 20 | 20 | |
| 21 | 21 | -- |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @return array of |
| 34 | 34 | * ['class_type'] => [ 'class_type', 'module', 'label', 'description', ['deleted'] ] |
| 35 | 35 | */ |
| 36 | - public function listClasses(&$paginator=[], $filters=[], $orderBy=[], $includeDeleted=false); |
|
| 36 | + public function listClasses(&$paginator = [], $filters = [], $orderBy = [], $includeDeleted = false); |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Create an IPhoebeClass interface for a new class reference. |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @throw \RuntimeException if the classRef already exists or something |
| 47 | 47 | * else went wrong during creation |
| 48 | 48 | */ |
| 49 | - public function addClass(&$classType, $module=''); |
|
| 49 | + public function addClass(&$classType, $module = ''); |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * Get hold of an IPhoebeClass interface for a particular class reference. |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @return null | \neon\phoebe\interfaces\IPhoebeClass |
| 60 | 60 | * returns null if the classType or version doesn't exist |
| 61 | 61 | */ |
| 62 | - public function getClass($classType, $version=null, $classOverrideCriteria=[]); |
|
| 62 | + public function getClass($classType, $version = null, $classOverrideCriteria = []); |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * Get hold of a set of IPhoebeClasses for a set of classType. The latest version |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * will return all rows that have been soft deleted. |
| 100 | 100 | * @return array an array of objects of this class |
| 101 | 101 | */ |
| 102 | - public function listObjects($classType, &$paginator=[], $filters=[], $orderBy=[], $additionalFields=[]); |
|
| 102 | + public function listObjects($classType, &$paginator = [], $filters = [], $orderBy = [], $additionalFields = []); |
|
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * Create and save a new IPhoebeObject of a particular class type |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @return \neon\phoebe\interfaces\IPhoebeObject |
| 112 | 112 | * @throw \RuntimeException if anything went wrong during the addition |
| 113 | 113 | */ |
| 114 | - public function addObject($classType, $classOverrideCriteria=[]); |
|
| 114 | + public function addObject($classType, $classOverrideCriteria = []); |
|
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * Get hold of a phoebe object interface for managing an instance |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * the set of fields provided. |
| 49 | 49 | * @return array a form definition |
| 50 | 50 | */ |
| 51 | - public function getClassFormDefinition(array $fields=[]); |
|
| 51 | + public function getClassFormDefinition(array $fields = []); |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Get the class definition in a suitable format to present to a class builder app |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * 'date' - a date used to select which override is active at that date |
| 156 | 156 | * @return null|array null if not found or the override parameters |
| 157 | 157 | */ |
| 158 | - public function findOverride($filters=[]); |
|
| 158 | + public function findOverride($filters = []); |
|
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | 161 | * Get an override by its uuid. This will return soft deleted overrides. |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @return uuid|errors returns the uuid of the created override or the array of |
| 179 | 179 | * errors if not possible |
| 180 | 180 | */ |
| 181 | - public function addOverride($label, $selector='', $activeFrom=null, $activeTo=null, $isActive=true); |
|
| 181 | + public function addOverride($label, $selector = '', $activeFrom = null, $activeTo = null, $isActive = true); |
|
| 182 | 182 | |
| 183 | 183 | /** |
| 184 | 184 | * Edit the properties of an override |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * an override and $force was not true, or the override does not apply to |
| 93 | 93 | * this class of object; and array if there are any other errors |
| 94 | 94 | */ |
| 95 | - public function setOverride($overrideUuid, $force=false); |
|
| 95 | + public function setOverride($overrideUuid, $force = false); |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * Get the class override used when creating the object |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * @return array an array of history entries with |
| 114 | 114 | * the historical uuid, and date archived |
| 115 | 115 | */ |
| 116 | - public function listHistory(&$paginator=[]); |
|
| 116 | + public function listHistory(&$paginator = []); |
|
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | 119 | * Get the object's historical data from its historical uuid |
@@ -82,13 +82,15 @@ |
||
| 82 | 82 | $types = $this->listPhoebeTypes(); |
| 83 | 83 | $requested = isset($types[$phoebeKey]) ? $types[$phoebeKey] : null; |
| 84 | 84 | // check that we can create the requested type |
| 85 | - if (!($requested && in_array($requested['status'], ['AVAILABLE', 'IN_DEVELOPMENT']))) |
|
| 86 | - return null; |
|
| 85 | + if (!($requested && in_array($requested['status'], ['AVAILABLE', 'IN_DEVELOPMENT']))) { |
|
| 86 | + return null; |
|
| 87 | + } |
|
| 87 | 88 | $adapter = $requested['adapter']; |
| 88 | - if (strpos($adapter, '\\') !== false) |
|
| 89 | - $type = $adapter; |
|
| 90 | - else |
|
| 91 | - $type = str_replace('ADAPTER', $requested['adapter'], $this->genericTypePath); |
|
| 89 | + if (strpos($adapter, '\\') !== false) { |
|
| 90 | + $type = $adapter; |
|
| 91 | + } else { |
|
| 92 | + $type = str_replace('ADAPTER', $requested['adapter'], $this->genericTypePath); |
|
| 93 | + } |
|
| 92 | 94 | return $type ? new $type : null; |
| 93 | 95 | } |
| 94 | 96 | |