diff --git a/composer.json b/composer.json
index deaffe5..a7bf3dc 100644
--- a/composer.json
+++ b/composer.json
@@ -13,7 +13,8 @@
"cakephp/migrations": "^4.0.0",
"phpstan/phpstan": "^2.1",
"dereuromark/composer-prefer-lowest": "^0.1.10",
- "cakedc/cakephp-phpstan": "^4.1"
+ "cakedc/cakephp-phpstan": "^4.1",
+ "fig-r/psr2r-sniffer": "^2.7"
},
"suggest": {
"dereuromark/cakephp-geo": "^3.2"
@@ -29,5 +30,18 @@
"Cake\\Test\\": "vendor/cakephp/cakephp/tests/",
"TestApp\\": "tests/test_app/src/"
}
+ },
+ "config": {
+ "allow-plugins": {
+ "dealerdirect/phpcodesniffer-composer-installer": false
+ }
+ },
+ "scripts": {
+ "cs-check": "vendor/bin/phpcs --colors --parallel=16",
+ "cs-fix": "vendor/bin/phpcbf --colors --parallel=16",
+ "lowest": "validate-prefer-lowest",
+ "lowest-setup": "composer update --prefer-lowest --prefer-stable --prefer-dist --no-interaction && cp composer.json composer.backup && composer require --dev dereuromark/composer-prefer-lowest && mv composer.backup composer.json",
+ "stan": "phpstan analyze"
}
}
+
diff --git a/config/Migrations/20240117020203_InitialAddresses.php b/config/Migrations/20240117020203_InitialAddresses.php
index 9170d4d..ce851b3 100644
--- a/config/Migrations/20240117020203_InitialAddresses.php
+++ b/config/Migrations/20240117020203_InitialAddresses.php
@@ -3,156 +3,155 @@ declare(strict_types=1);
use Migrations\AbstractMigration;
-class InitialAddresses extends AbstractMigration
-{
- /**
+class InitialAddresses extends AbstractMigration {
+
+ /**
* Up Method.
*
* More information on this method is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-up-method
* @return void
*/
- public function up(): void
- {
- $this->table('addresses')
- ->addColumn('address_name', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('contact_name', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('address_line1', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => false,
- ])
- ->addColumn('address_line2', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('city', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => false,
- ])
- ->addColumn('city_id', 'integer', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- 'signed' => true,
- ])
- ->addColumn('state', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => false,
- ])
- ->addColumn('state_id', 'integer', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- 'signed' => true,
- ])
- ->addColumn('postal_code', 'string', [
- 'default' => null,
- 'limit' => 25,
- 'null' => false,
- ])
- ->addColumn('country', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => false,
- ])
- ->addColumn('country_id', 'integer', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- 'signed' => true,
- ])
- ->addColumn('phone_number', 'string', [
- 'default' => null,
- 'limit' => 25,
- 'null' => true,
- ])
- ->addColumn('email', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('notes', 'text', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- ])
- ->create();
+ public function up(): void {
+ $this->table('addresses')
+ ->addColumn('address_name', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('contact_name', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('address_line1', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => false,
+ ])
+ ->addColumn('address_line2', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('city', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => false,
+ ])
+ ->addColumn('city_id', 'integer', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => true,
+ 'signed' => true,
+ ])
+ ->addColumn('state', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => false,
+ ])
+ ->addColumn('state_id', 'integer', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => true,
+ 'signed' => true,
+ ])
+ ->addColumn('postal_code', 'string', [
+ 'default' => null,
+ 'limit' => 25,
+ 'null' => false,
+ ])
+ ->addColumn('country', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => false,
+ ])
+ ->addColumn('country_id', 'integer', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => true,
+ 'signed' => true,
+ ])
+ ->addColumn('phone_number', 'string', [
+ 'default' => null,
+ 'limit' => 25,
+ 'null' => true,
+ ])
+ ->addColumn('email', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('notes', 'text', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => true,
+ ])
+ ->create();
- $this->table('cities')
- ->addColumn('name', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => false,
- ])
- ->addColumn('state_id', 'integer', [
- 'default' => null,
- 'limit' => null,
- 'null' => false,
- 'signed' => false,
- ])
- ->addColumn('state_code', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => false,
- ])
- ->addColumn('country_id', 'integer', [
- 'default' => null,
- 'limit' => null,
- 'null' => false,
- 'signed' => false,
- ])
- ->addColumn('country_code', 'char', [
- 'default' => null,
- 'limit' => 2,
- 'null' => false,
- ])
- ->addColumn('latitude', 'decimal', [
- 'default' => null,
- 'null' => false,
- 'precision' => 10,
- 'scale' => 8,
- 'signed' => true,
- ])
- ->addColumn('longitude', 'decimal', [
- 'default' => null,
- 'null' => false,
- 'precision' => 11,
- 'scale' => 8,
- 'signed' => true,
- ])
- ->addColumn('created_at', 'timestamp', [
- 'default' => '2014-01-01 14:31:01',
- 'limit' => null,
- 'null' => false,
- ])
- ->addColumn('updated_at', 'timestamp', [
- 'default' => '2014-01-01 14:31:01',
- 'limit' => null,
- 'null' => false,
- ])
- ->addColumn('flag', 'boolean', [
- 'default' => true,
- 'limit' => null,
- 'null' => false,
- ])
- ->addColumn('wikiDataId', 'string', [
- 'comment' => 'Rapid API GeoDB Cities',
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
+ $this->table('cities')
+ ->addColumn('name', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => false,
+ ])
+ ->addColumn('state_id', 'integer', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => false,
+ 'signed' => false,
+ ])
+ ->addColumn('state_code', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => false,
+ ])
+ ->addColumn('country_id', 'integer', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => false,
+ 'signed' => false,
+ ])
+ ->addColumn('country_code', 'char', [
+ 'default' => null,
+ 'limit' => 2,
+ 'null' => false,
+ ])
+ ->addColumn('latitude', 'decimal', [
+ 'default' => null,
+ 'null' => false,
+ 'precision' => 10,
+ 'scale' => 8,
+ 'signed' => true,
+ ])
+ ->addColumn('longitude', 'decimal', [
+ 'default' => null,
+ 'null' => false,
+ 'precision' => 11,
+ 'scale' => 8,
+ 'signed' => true,
+ ])
+ ->addColumn('created_at', 'timestamp', [
+ 'default' => '2014-01-01 14:31:01',
+ 'limit' => null,
+ 'null' => false,
+ ])
+ ->addColumn('updated_at', 'timestamp', [
+ 'default' => '2014-01-01 14:31:01',
+ 'limit' => null,
+ 'null' => false,
+ ])
+ ->addColumn('flag', 'boolean', [
+ 'default' => true,
+ 'limit' => null,
+ 'null' => false,
+ ])
+ ->addColumn('wikiDataId', 'string', [
+ 'comment' => 'Rapid API GeoDB Cities',
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
// ->addIndex(
// [
// 'state_id',
@@ -169,322 +168,322 @@ class InitialAddresses extends AbstractMigration
// 'name' => 'cities_test_ibfk_2',
// ]
// )
- ->create();
+ ->create();
- $this->table('countries')
- ->addColumn('name', 'string', [
- 'default' => null,
- 'limit' => 100,
- 'null' => false,
- ])
- ->addColumn('iso3', 'char', [
- 'default' => null,
- 'limit' => 3,
- 'null' => true,
- ])
- ->addColumn('numeric_code', 'char', [
- 'default' => null,
- 'limit' => 3,
- 'null' => true,
- ])
- ->addColumn('iso2', 'char', [
- 'default' => null,
- 'limit' => 2,
- 'null' => true,
- ])
- ->addColumn('phonecode', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('capital', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('currency', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('currency_name', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('currency_symbol', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('tld', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('native', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('region', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('region_id', 'integer', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- 'signed' => false,
- ])
- ->addColumn('subregion', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('subregion_id', 'integer', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- 'signed' => false,
- ])
- ->addColumn('nationality', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('timezones', 'text', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- ])
- ->addColumn('translations', 'text', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- ])
- ->addColumn('latitude', 'decimal', [
- 'default' => null,
- 'null' => true,
- 'precision' => 10,
- 'scale' => 8,
- 'signed' => true,
- ])
- ->addColumn('longitude', 'decimal', [
- 'default' => null,
- 'null' => true,
- 'precision' => 11,
- 'scale' => 8,
- 'signed' => true,
- ])
- ->addColumn('emoji', 'string', [
- 'default' => null,
- 'limit' => 191,
- 'null' => true,
- ])
- ->addColumn('emojiU', 'string', [
- 'default' => null,
- 'limit' => 191,
- 'null' => true,
- ])
- ->addColumn('created_at', 'timestamp', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- ])
- ->addColumn('updated_at', 'timestamp', [
- 'default' => '2014-01-01 14:31:01',
- 'limit' => null,
- 'null' => false,
- ])
- ->addColumn('flag', 'boolean', [
- 'default' => true,
- 'limit' => null,
- 'null' => false,
- ])
- ->addColumn('wikiDataId', 'string', [
- 'comment' => 'Rapid API GeoDB Cities',
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addIndex(
- [
- 'region_id',
- ],
- [
- 'name' => 'country_continent',
- ]
- )
- ->addIndex(
- [
- 'subregion_id',
- ],
- [
- 'name' => 'country_subregion',
- ]
- )
- ->create();
+ $this->table('countries')
+ ->addColumn('name', 'string', [
+ 'default' => null,
+ 'limit' => 100,
+ 'null' => false,
+ ])
+ ->addColumn('iso3', 'char', [
+ 'default' => null,
+ 'limit' => 3,
+ 'null' => true,
+ ])
+ ->addColumn('numeric_code', 'char', [
+ 'default' => null,
+ 'limit' => 3,
+ 'null' => true,
+ ])
+ ->addColumn('iso2', 'char', [
+ 'default' => null,
+ 'limit' => 2,
+ 'null' => true,
+ ])
+ ->addColumn('phonecode', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('capital', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('currency', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('currency_name', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('currency_symbol', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('tld', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('native', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('region', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('region_id', 'integer', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => true,
+ 'signed' => false,
+ ])
+ ->addColumn('subregion', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('subregion_id', 'integer', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => true,
+ 'signed' => false,
+ ])
+ ->addColumn('nationality', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('timezones', 'text', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => true,
+ ])
+ ->addColumn('translations', 'text', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => true,
+ ])
+ ->addColumn('latitude', 'decimal', [
+ 'default' => null,
+ 'null' => true,
+ 'precision' => 10,
+ 'scale' => 8,
+ 'signed' => true,
+ ])
+ ->addColumn('longitude', 'decimal', [
+ 'default' => null,
+ 'null' => true,
+ 'precision' => 11,
+ 'scale' => 8,
+ 'signed' => true,
+ ])
+ ->addColumn('emoji', 'string', [
+ 'default' => null,
+ 'limit' => 191,
+ 'null' => true,
+ ])
+ ->addColumn('emojiU', 'string', [
+ 'default' => null,
+ 'limit' => 191,
+ 'null' => true,
+ ])
+ ->addColumn('created_at', 'timestamp', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => true,
+ ])
+ ->addColumn('updated_at', 'timestamp', [
+ 'default' => '2014-01-01 14:31:01',
+ 'limit' => null,
+ 'null' => false,
+ ])
+ ->addColumn('flag', 'boolean', [
+ 'default' => true,
+ 'limit' => null,
+ 'null' => false,
+ ])
+ ->addColumn('wikiDataId', 'string', [
+ 'comment' => 'Rapid API GeoDB Cities',
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addIndex(
+ [
+ 'region_id',
+ ],
+ [
+ 'name' => 'country_continent',
+ ],
+ )
+ ->addIndex(
+ [
+ 'subregion_id',
+ ],
+ [
+ 'name' => 'country_subregion',
+ ],
+ )
+ ->create();
- $this->table('regions')
- ->addColumn('name', 'string', [
- 'default' => null,
- 'limit' => 100,
- 'null' => false,
- ])
- ->addColumn('translations', 'text', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- ])
- ->addColumn('created_at', 'timestamp', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- ])
- ->addColumn('updated_at', 'timestamp', [
- 'default' => '2014-01-01 14:31:01',
- 'limit' => null,
- 'null' => false,
- ])
- ->addColumn('flag', 'boolean', [
- 'default' => true,
- 'limit' => null,
- 'null' => false,
- ])
- ->addColumn('wikiDataId', 'string', [
- 'comment' => 'Rapid API GeoDB Cities',
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->create();
+ $this->table('regions')
+ ->addColumn('name', 'string', [
+ 'default' => null,
+ 'limit' => 100,
+ 'null' => false,
+ ])
+ ->addColumn('translations', 'text', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => true,
+ ])
+ ->addColumn('created_at', 'timestamp', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => true,
+ ])
+ ->addColumn('updated_at', 'timestamp', [
+ 'default' => '2014-01-01 14:31:01',
+ 'limit' => null,
+ 'null' => false,
+ ])
+ ->addColumn('flag', 'boolean', [
+ 'default' => true,
+ 'limit' => null,
+ 'null' => false,
+ ])
+ ->addColumn('wikiDataId', 'string', [
+ 'comment' => 'Rapid API GeoDB Cities',
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->create();
- $this->table('states')
- ->addColumn('name', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => false,
- ])
- ->addColumn('country_id', 'integer', [
- 'default' => null,
- 'limit' => null,
- 'null' => false,
- 'signed' => false,
- ])
- ->addColumn('country_code', 'char', [
- 'default' => null,
- 'limit' => 2,
- 'null' => false,
- ])
- ->addColumn('fips_code', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('iso2', 'string', [
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('type', 'string', [
- 'default' => null,
- 'limit' => 191,
- 'null' => true,
- ])
- ->addColumn('latitude', 'decimal', [
- 'default' => null,
- 'null' => true,
- 'precision' => 10,
- 'scale' => 8,
- 'signed' => true,
- ])
- ->addColumn('longitude', 'decimal', [
- 'default' => null,
- 'null' => true,
- 'precision' => 11,
- 'scale' => 8,
- 'signed' => true,
- ])
- ->addColumn('created_at', 'timestamp', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- ])
- ->addColumn('updated_at', 'timestamp', [
- 'default' => '2014-01-01 14:31:01',
- 'limit' => null,
- 'null' => false,
- ])
- ->addColumn('flag', 'boolean', [
- 'default' => true,
- 'limit' => null,
- 'null' => false,
- ])
- ->addColumn('wikiDataId', 'string', [
- 'comment' => 'Rapid API GeoDB Cities',
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addIndex(
- [
- 'country_id',
- ],
- [
- 'name' => 'country_region',
- ]
- )
- ->create();
+ $this->table('states')
+ ->addColumn('name', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => false,
+ ])
+ ->addColumn('country_id', 'integer', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => false,
+ 'signed' => false,
+ ])
+ ->addColumn('country_code', 'char', [
+ 'default' => null,
+ 'limit' => 2,
+ 'null' => false,
+ ])
+ ->addColumn('fips_code', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('iso2', 'string', [
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addColumn('type', 'string', [
+ 'default' => null,
+ 'limit' => 191,
+ 'null' => true,
+ ])
+ ->addColumn('latitude', 'decimal', [
+ 'default' => null,
+ 'null' => true,
+ 'precision' => 10,
+ 'scale' => 8,
+ 'signed' => true,
+ ])
+ ->addColumn('longitude', 'decimal', [
+ 'default' => null,
+ 'null' => true,
+ 'precision' => 11,
+ 'scale' => 8,
+ 'signed' => true,
+ ])
+ ->addColumn('created_at', 'timestamp', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => true,
+ ])
+ ->addColumn('updated_at', 'timestamp', [
+ 'default' => '2014-01-01 14:31:01',
+ 'limit' => null,
+ 'null' => false,
+ ])
+ ->addColumn('flag', 'boolean', [
+ 'default' => true,
+ 'limit' => null,
+ 'null' => false,
+ ])
+ ->addColumn('wikiDataId', 'string', [
+ 'comment' => 'Rapid API GeoDB Cities',
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addIndex(
+ [
+ 'country_id',
+ ],
+ [
+ 'name' => 'country_region',
+ ],
+ )
+ ->create();
- $this->table('subregions')
- ->addColumn('name', 'string', [
- 'default' => null,
- 'limit' => 100,
- 'null' => false,
- ])
- ->addColumn('translations', 'text', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- ])
- ->addColumn('region_id', 'integer', [
- 'default' => null,
- 'limit' => null,
- 'null' => false,
- 'signed' => false,
- ])
- ->addColumn('created_at', 'timestamp', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- ])
- ->addColumn('updated_at', 'timestamp', [
- 'default' => '2014-01-01 14:31:01',
- 'limit' => null,
- 'null' => false,
- ])
- ->addColumn('flag', 'boolean', [
- 'default' => true,
- 'limit' => null,
- 'null' => false,
- ])
- ->addColumn('wikiDataId', 'string', [
- 'comment' => 'Rapid API GeoDB Cities',
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addIndex(
- [
- 'region_id',
- ],
- [
- 'name' => 'subregion_continent',
- ]
- )
- ->create();
+ $this->table('subregions')
+ ->addColumn('name', 'string', [
+ 'default' => null,
+ 'limit' => 100,
+ 'null' => false,
+ ])
+ ->addColumn('translations', 'text', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => true,
+ ])
+ ->addColumn('region_id', 'integer', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => false,
+ 'signed' => false,
+ ])
+ ->addColumn('created_at', 'timestamp', [
+ 'default' => null,
+ 'limit' => null,
+ 'null' => true,
+ ])
+ ->addColumn('updated_at', 'timestamp', [
+ 'default' => '2014-01-01 14:31:01',
+ 'limit' => null,
+ 'null' => false,
+ ])
+ ->addColumn('flag', 'boolean', [
+ 'default' => true,
+ 'limit' => null,
+ 'null' => false,
+ ])
+ ->addColumn('wikiDataId', 'string', [
+ 'comment' => 'Rapid API GeoDB Cities',
+ 'default' => null,
+ 'limit' => 255,
+ 'null' => true,
+ ])
+ ->addIndex(
+ [
+ 'region_id',
+ ],
+ [
+ 'name' => 'subregion_continent',
+ ],
+ )
+ ->create();
// $this->table('cities')
// ->addForeignKey(
@@ -557,49 +556,49 @@ class InitialAddresses extends AbstractMigration
// ]
// )
// ->update();
- }
+ }
- /**
+ /**
* Down Method.
*
* More information on this method is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-down-method
* @return void
*/
- public function down(): void
- {
- $this->table('cities')
- ->dropForeignKey(
- 'country_id'
- )
- ->dropForeignKey(
- 'state_id'
- )->save();
+ public function down(): void {
+ $this->table('cities')
+ ->dropForeignKey(
+ 'country_id',
+ )
+ ->dropForeignKey(
+ 'state_id',
+ )->save();
- $this->table('countries')
- ->dropForeignKey(
- 'subregion_id'
- )
- ->dropForeignKey(
- 'region_id'
- )
- ->save();
+ $this->table('countries')
+ ->dropForeignKey(
+ 'subregion_id',
+ )
+ ->dropForeignKey(
+ 'region_id',
+ )
+ ->save();
- $this->table('states')
- ->dropForeignKey(
- 'country_id'
- )->save();
+ $this->table('states')
+ ->dropForeignKey(
+ 'country_id',
+ )->save();
- $this->table('subregions')
- ->dropForeignKey(
- 'region_id'
- )->save();
+ $this->table('subregions')
+ ->dropForeignKey(
+ 'region_id',
+ )->save();
+
+ $this->table('addresses')->drop()->save();
+ $this->table('cities')->drop()->save();
+ $this->table('countries')->drop()->save();
+ $this->table('regions')->drop()->save();
+ $this->table('states')->drop()->save();
+ $this->table('subregions')->drop()->save();
+ }
- $this->table('addresses')->drop()->save();
- $this->table('cities')->drop()->save();
- $this->table('countries')->drop()->save();
- $this->table('regions')->drop()->save();
- $this->table('states')->drop()->save();
- $this->table('subregions')->drop()->save();
- }
}
diff --git a/config/Migrations/20251121020203_InitialAddressesDynamicForeignKey.php b/config/Migrations/20251121020203_InitialAddressesDynamicForeignKey.php
index 079378b..d3ec8c9 100644
--- a/config/Migrations/20251121020203_InitialAddressesDynamicForeignKey.php
+++ b/config/Migrations/20251121020203_InitialAddressesDynamicForeignKey.php
@@ -3,43 +3,42 @@ declare(strict_types=1);
use Migrations\AbstractMigration;
-class InitialAddressesDynamicForeignKey extends AbstractMigration
-{
- /**
+class InitialAddressesDynamicForeignKey extends AbstractMigration {
+
+ /**
* Up Method.
*
* More information on this method is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-up-method
* @return void
*/
- public function up(): void
- {
- $this->table('addresses')
- ->addColumn('foreign_key', 'string', [
- 'limit' => 45,
- 'null' => true,
- 'default' => null,
- ])
- ->addColumn('model', 'string', [
- 'limit' => 255,
- 'null' => true,
- 'default' => null,
- ])
- ->update();
- }
+ public function up(): void {
+ $this->table('addresses')
+ ->addColumn('foreign_key', 'string', [
+ 'limit' => 45,
+ 'null' => true,
+ 'default' => null,
+ ])
+ ->addColumn('model', 'string', [
+ 'limit' => 255,
+ 'null' => true,
+ 'default' => null,
+ ])
+ ->update();
+ }
- /**
+ /**
* Down Method.
*
* More information on this method is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-down-method
* @return void
*/
- public function down(): void
- {
- $this->table('addresses')
- ->removeColumn('foreign_key')
- ->removeColumn('model')
- ->save();
- }
+ public function down(): void {
+ $this->table('addresses')
+ ->removeColumn('foreign_key')
+ ->removeColumn('model')
+ ->save();
+ }
+
}
diff --git a/config/app.example.php b/config/app.example.php
index 72877d0..fe747ae 100644
--- a/config/app.example.php
+++ b/config/app.example.php
@@ -3,7 +3,5 @@
// The following configs can be globally configured, copy the array content over to your ROOT/config
return [
- 'CakeAddresses' => [
-
- ],
+ 'CakeAddresses' => [],
];
diff --git a/config/routes.php b/config/routes.php
index 72a6ae0..259481d 100644
--- a/config/routes.php
+++ b/config/routes.php
@@ -1,14 +1,15 @@
plugin(
- 'CakeAddresses',
- ['path' => '/address-manager'],
- function ($routes) {
- $routes->setRouteClass(DashedRoute::class);
- $routes->connect('/addresses', ['controller' => 'Addresses', 'action' => 'index']);
- $routes->connect('/addresses/view/{id}', ['controller' => 'Addresses', 'action' => 'view', ], ['id' => '\d+', 'pass' => ['id']]);
- $routes->connect('/addresses/edit/{id}', ['controller' => 'Addresses', 'action' => 'update'], ['id' => '\d+', 'pass' => ['id']]);
- $routes->connect('/addresses/add', ['controller' => 'Addresses', 'action' => 'add']);
- }
+ 'CakeAddresses',
+ ['path' => '/address-manager'],
+ function ($routes) {
+ $routes->setRouteClass(DashedRoute::class);
+ $routes->connect('/addresses', ['controller' => 'Addresses', 'action' => 'index']);
+ $routes->connect('/addresses/view/{id}', ['controller' => 'Addresses', 'action' => 'view'], ['id' => '\d+', 'pass' => ['id']]);
+ $routes->connect('/addresses/edit/{id}', ['controller' => 'Addresses', 'action' => 'update'], ['id' => '\d+', 'pass' => ['id']]);
+ $routes->connect('/addresses/add', ['controller' => 'Addresses', 'action' => 'add']);
+ },
);
diff --git a/phpcs.xml b/phpcs.xml
index a9d60d0..689bfe3 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -9,7 +9,7 @@
/tests/test_files/
/tests/test_app/
-
+
*/config/Migrations/*