Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
1,089 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,3 @@ DB_PORT=3306 | |
DB_DATABASE=../db/multiflexibee.sqlite | ||
DB_USERNAME=multiflexibee | ||
DB_PASSWORD=multiflexibee | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
class Applications extends AbstractMigration { | ||
|
||
/** | ||
* Change Method. | ||
* | ||
* Write your reversible migrations using this method. | ||
* | ||
* More information on writing migrations is available here: | ||
* https://book.cakephp.org/phinx/0/en/migrations.html | ||
* | ||
* The following commands can be used in this method and Phinx will | ||
* automatically reverse them when rolling back: | ||
* | ||
* createTable | ||
* renameTable | ||
* addColumn | ||
* addCustomColumn | ||
* renameColumn | ||
* addIndex | ||
* addForeignKey | ||
* | ||
* Any other destructive changes will result in an error when trying to | ||
* rollback the migration. | ||
* | ||
* Remember to call "create()" or "update()" and NOT "save()" when working | ||
* with the Table class. | ||
*/ | ||
public function change() { | ||
$table = $this->table('apps'); | ||
$table | ||
->addColumn('enabled', 'boolean', array('default' => false)) | ||
->addColumn('image', 'text', ['null' => true]) | ||
->addColumn('nazev', 'string', ['null' => true, 'limit' => 32]) | ||
->addColumn('popis', 'string', ['comment' => 'App Description']) | ||
->addColumn('executable', 'string', ['comment' => '/usr/bin/runme']) | ||
->addColumn('DatCreate', 'datetime', []) | ||
->addColumn('DatUpdate', 'datetime', ['null' => true]) | ||
->addIndex(['nazev'], ['unique' => true]) | ||
->addIndex(['executable'], ['unique' => true]) | ||
->create(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
class AppToCompany extends AbstractMigration { | ||
|
||
/** | ||
* Change Method. | ||
* | ||
* Write your reversible migrations using this method. | ||
* | ||
* More information on writing migrations is available here: | ||
* https://book.cakephp.org/phinx/0/en/migrations.html | ||
* | ||
* The following commands can be used in this method and Phinx will | ||
* automatically reverse them when rolling back: | ||
* | ||
* createTable | ||
* renameTable | ||
* addColumn | ||
* addCustomColumn | ||
* renameColumn | ||
* addIndex | ||
* addForeignKey | ||
* | ||
* Any other destructive changes will result in an error when trying to | ||
* rollback the migration. | ||
* | ||
* Remember to call "create()" or "update()" and NOT "save()" when working | ||
* with the Table class. | ||
*/ | ||
public function change() { | ||
$table = $this->table('appcompany'); | ||
$table->addColumn('app_id', 'integer', array('null' => false)) | ||
->addColumn('company_id', 'integer', array('null' => false)) | ||
->addIndex(['app_id', 'company_id'], ['unique' => true]) | ||
->addForeignKey('app_id', 'apps', ['id'], ['constraint' => 'app_must_exist']) | ||
->addForeignKey('company_id', 'company', ['id'], ['constraint' => 'company_must_exist']); | ||
|
||
$table->save(); | ||
} | ||
|
||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
use Phinx\Seed\AbstractSeed; | ||
|
||
class CompanySeeder extends AbstractSeed { | ||
|
||
/** | ||
* Run Method. | ||
* | ||
* Write your database seeder using this method. | ||
* | ||
* More information on writing seeders is available here: | ||
* http://docs.phinx.org/en/latest/seeding.html | ||
*/ | ||
public function run() { | ||
|
||
$data = [ | ||
[ | ||
'id' => 0, | ||
'enabled' => true, | ||
'flexibee' => 0, | ||
'nazev' => 'Demo Firma', | ||
'ic' => '12345678', | ||
'company' => 'demo', | ||
'rw' => 'true', | ||
'setup' => false, | ||
'webhook' => false, | ||
'DatCreate' => date('Y-m-d H:i:s') | ||
], | ||
[ | ||
'id' => 1, | ||
'enabled' => true, | ||
'flexibee' => 0, | ||
'nazev' => 'Ja Zivnostnik', | ||
'ic' => '87654321', | ||
'company' => 'demo_de', | ||
'rw' => 'true', | ||
'setup' => false, | ||
'webhook' => false, | ||
'DatCreate' => date('Y-m-d H:i:s') | ||
] | ||
]; | ||
|
||
$posts = $this->table('company'); | ||
$posts->insert($data)->save(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Phinx\Seed\AbstractSeed; | ||
|
||
class CustomerSeeder extends AbstractSeed { | ||
|
||
/** | ||
* Run Method. | ||
* | ||
* Write your database seeder using this method. | ||
* | ||
* More information on writing seeders is available here: | ||
* http://docs.phinx.org/en/latest/seeding.html | ||
*/ | ||
public function run() { | ||
$data = [ | ||
[ | ||
'id' => 0, | ||
'enabled' => true, | ||
'email' => 'demo@flexibee.eu', | ||
'firstname' => 'Demo', | ||
'lastname' => 'Demo', | ||
'password' => '', | ||
'login' => 'demo', | ||
'DatCreate' => date('Y-m-d H:i:s') | ||
] | ||
]; | ||
|
||
$posts = $this->table('customer'); | ||
$posts->insert($data)->save(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Phinx\Seed\AbstractSeed; | ||
|
||
class FlexiBeeSeeder extends AbstractSeed { | ||
|
||
/** | ||
* Run Method. | ||
* | ||
* Write your database seeder using this method. | ||
* | ||
* More information on writing seeders is available here: | ||
* http://docs.phinx.org/en/latest/seeding.html | ||
*/ | ||
public function run() { | ||
|
||
$data = [ | ||
[ | ||
'id' => 0, | ||
'url' => 'https://demo.flexibee.eu:5434', | ||
'name' => 'Demo EU', | ||
'user' => 'winstrom', | ||
'password' => 'winstrom', | ||
'DatCreate' => date('Y-m-d H:i:s') | ||
] | ||
]; | ||
|
||
$posts = $this->table('flexibees'); | ||
$posts->insert($data) | ||
->save(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/** | ||
* Multi FlexiBee Setup - AppToCompany class | ||
* | ||
* @author Vítězslav Dvořák <vitex@arachne.cz> | ||
* @copyright 2020 Vitex Software | ||
*/ | ||
|
||
namespace FlexiPeeHP\MultiSetup; | ||
|
||
/** | ||
* Description of AppToCompany | ||
* | ||
* @author vitex | ||
*/ | ||
class AppToCompany extends Engine { | ||
|
||
public function __construct($identifier = null, $options = []) { | ||
$this->myTable = 'appcompany'; | ||
parent::__construct($identifier, $options); | ||
} | ||
|
||
public function setState(bool $state) { | ||
if ($state === true) { | ||
$result = $this->insertToSQL(); | ||
} else { | ||
$result = $this->deleteFromSQL(); | ||
} | ||
return $result; | ||
} | ||
|
||
} |
Oops, something went wrong.