Browse Source

twbootstrap renamed to bootstrap

main
parent
commit
0af2153254
  1. 6
      Examples/index.php
  2. 4
      composer.json
  3. 13
      src/Ease/SQL/Engine.php
  4. 3
      src/Ease/SQL/Orm.php
  5. 3
      tests/bootstrap.php
  6. BIN
      tests/test.sqlite

6
Examples/index.php

@ -1,5 +1,7 @@
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
$engine = new \Ease\SQL\Engine();
$engine->insertToSQL([]);
$engine = new \Ease\SQL\Engine();
$engine->insertToSQL([]);

4
composer.json

@ -8,13 +8,13 @@
}
],
"require": {
"robmorgan/phinx": "^0.12.3",
"vitexsoftware/ease-core": "^1.1",
"fpdo/fluentpdo": "^2.1"
},
"require-dev": {
"phpunit/phpunit": "^9",
"vlucas/phpdotenv": "^3"
"vlucas/phpdotenv": "^3",
"robmorgan/phinx": "^0.12.3"
},
"autoload": {
"psr-4": {

13
src/Ease/SQL/Engine.php

@ -105,6 +105,19 @@ class Engine extends \Ease\Brick {
return $this->listingQuery()->where($conditons);
}
/**
* Always return array
*
* @param \Envms\FluentPDO\Queries\Select $query
*
* @return array
*/
public static function fixIterator($query)
{
$data = $query->execute();
return $data ? $data : [];
}
/**
* Get All records
*

3
src/Ease/SQL/Orm.php

@ -343,8 +343,7 @@ trait Orm {
if (isset($this->lastModifiedColumn) && !isset($data[$this->lastModifiedColumn])) {
$data[$this->lastModifiedColumn] = date("Y-m-d H:i:s");
}
return $this->getFluentPDO(false, true)->update($this->getMyTable())->set($data)->where($this->getKeyColumn(), $key)->execute();
return $this->getFluentPDO(false, true)->update($this->getMyTable())->set($data)->where($this->getKeyColumn(), $key)->execute() ? $key : null;
}
/**

3
tests/bootstrap.php

@ -12,3 +12,6 @@ define('DB_USERNAME', 'phpunit');
define('DB_PASSWORD', 'phpunit');
new \Phinx\Db\Action\DropTable(new \Phinx\Db\Table\Table('test'));

BIN
tests/test.sqlite

Binary file not shown.
Loading…
Cancel
Save