Skip to content

Commit

Permalink
Releasing 2.0.2 into master (#511)
Browse files Browse the repository at this point in the history
* wip

* wip

* fixes

* Feature/test1 (#483)

* fixes

* testtisg

* wip

* test

* backmerge master

* normalize everything

* added locale test (#485)

* added locale test

* Apply fixes from StyleCI

* wip

* wip

* Apply fixes from StyleCI

* Update CHANGELOG.md

* Implement #386 (#477)

* Implement #386

* Apply fixes from StyleCI

* Update Field.php

* Update Model.php

* Update Helper.php

* Apply fixes from StyleCI

* move functionality to atk4/core

* Apply fixes from StyleCI

* fix traits

* Apply fixes from StyleCI

* fix typo

* Feature/pgsql test (#486)

* fix one test

* Setting current dependencies

* wip

* wip

* Add matrix testing (#492)

* Test using matrix

* wip

* wip

* wip

* clean up bundler

* clean up bundler (#493)

* wip

* Fix/delete callback (#488)

* fix one test

* Setting current dependencies

* fix/delete callback

* Update composer.json

* Fix/persistence sql condition (#487)

* fix one test

* Setting current dependencies

* fix wrong assignment of value as condition

* Update composer.json

* Update SQL.php

* Feature remove specified action (#489)

* fix one test

* Setting current dependencies

* add method to remove specified action(s) from model

* Update Model.php

* spaces

* Feature/add confirmation callback argument (#491)

* fix one test

* Setting current dependencies

* pass the action object as argument to confirmation callback

* badge

* Feature/set custom edit exec button (#490)

* fix one test

* Setting current dependencies

* use custom exec button on edit action

* Update Model.php

* remove class, use seed

Co-authored-by: Imants Horsts <DarkSide666@users.noreply.github.com>

* model default add field property (#454)

* use the object default add field property

* no need for double brackets.

* force tests

Co-authored-by: Romans Malinovskis <me@nearly.guru>
Co-authored-by: Imants Horsts <DarkSide666@users.noreply.github.com>

* Fix empty array condition (#498)

* more tests

* Apply fixes from StyleCI

* better implementation for addFields() and test cases (#499)

* better implementation for addFields() and test cases

* Apply fixes from StyleCI

* use shorthand method

* simplify code

* implement `exprNow()` method. Rely on dsql PR.

* Apply fixes from StyleCI

* pass

* add docs

Co-authored-by: Romans Malinovskis <me@nearly.guru>

* Fix/ Small Action related fix (#502)

* Fix/ Small Action related fix

- Set Edit action exec button labe lto 'Save' by default
 - Set Edit action exec button colot to blue by default
- Set default description for Add action in model
- Add method to retreive model from Action

* Apply fixes from StyleCI

* fix comment

Co-authored-by: Imants Horsts <DarkSide666@users.noreply.github.com>

* update multiple delete example (#503)

* now supports multiple filter options in getFields()

* Apply fixes from StyleCI

* Accept any DateTimeInterface impl. for datetime (#505)

* Accept any DateTimeInterface impl. for datetime

* Fix DateTime::getTimezone method name

* Fix setTimezone for any instance of DateTimeInterface

* Add microseconds persistence support for datetime/time types + fix normalization/cloning issue (#504)

* Fix datetime normalization cloning

* Add microseconds persistence support for datetime/time types

Co-authored-by: Imants Horsts <DarkSide666@users.noreply.github.com>

* include comment about hooks and example how to execute them (#510)

* update composer

* Update release-drafter.yml

* Update bundler.yml

* Setting release dependencies

Co-authored-by: Romans Malinovskis <me@nearly.guru>
Co-authored-by: Imants Horsts <DarkSide666@users.noreply.github.com>
Co-authored-by: Georgi Hristov <georgehristov@users.noreply.github.com>
Co-authored-by: Mimo <ddobchev@gmail.com>
Co-authored-by: Alain Belair <belair.alain@gmail.com>
Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>
Co-authored-by: GitHub Web Flow <noreply@github.com>
  • Loading branch information
8 people committed Feb 11, 2020
1 parent 20e4eaf commit f916c24
Show file tree
Hide file tree
Showing 29 changed files with 428 additions and 239 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/bundler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,29 @@ jobs:
- run: echo ${{ github.ref }}
- name: Update to stable dependencies
run: |
jq 'del(.require["atk4/core"]) | del(.require["atk4/dsql"]) | del(.["require-dev"]["atk4/schema"])' < composer.json > tmp && mv tmp composer.json
composer require --no-progress --no-suggest --prefer-dist --optimize-autoloader atk4/core atk4/dsql
composer require --no-progress --no-suggest --prefer-dist --optimize-autoloader --dev atk4/schema
composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader
# replaces X keys with X-release keys
jq '. as $in | reduce (keys_unsorted[] | select(endswith("-release")|not)) as $k ({}; . + {($k) : (($k + "-release") as $kr | $in | if has($kr) then .[$kr] else .[$k] end) } )' < composer.json > tmp && mv tmp composer.json
v=$(echo ${{ github.ref }} | cut -d / -f 4)
echo "::set-env name=version::$v"
- uses: teaminkling/autocommit@master
with:
commit-message: Setting current dependencies
commit-message: Setting release dependencies
- uses: ad-m/github-push-action@master
with:
branch: ${{ github.ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: pull-request
uses: repo-sync/pull-request@v2
uses: romaninsh/pull-request@master
with:
source_branch: "" # If blank, default: triggered branch
source_branch: "release/${{ env.version }}"
destination_branch: "master" # If blank, default: master
pr_title: "Releasing ${{ github.ref }} into master"
pr_title: "Releasing ${{ env.version }} into master"
pr_body: |
- [ ] Review changes (must include stable dependencies)
- [ ] Merge this PR into master (will delete ${{ github.ref }})
- [ ] Go to Releases and create TAG from master
----------
Do not merge master into develop
pr_reviewer: "romaninsh"
pr_assignee: "romaninsh"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: toolmantim/release-drafter@v5.2.0
- uses: toolmantim/release-drafter@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Agile Data is a framework for defining your "business layer" which is separate f

[![Documentation Status](https://readthedocs.org/projects/agile-data/badge/?version=latest)](http://agile-data.readthedocs.io/en/latest/?badge=latest)
[![Build Status](https://travis-ci.org/atk4/data.png?branch=develop)](https://travis-ci.org/atk4/data)
![Build](https://github.com/atk4/data/workflows/Unit%20Testing/badge.svg)
[![Code Climate](https://codeclimate.com/github/atk4/data/badges/gpa.svg)](https://codeclimate.com/github/atk4/data)
[![StyleCI](https://styleci.io/repos/56442737/shield)](https://styleci.io/repos/56442737)
[![CodeCov](https://codecov.io/gh/atk4/data/branch/develop/graph/badge.svg)](https://codecov.io/gh/atk4/data)
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"nosql",
"mongodb",
"mysql",
"oracle",
"postgresql"
],
"homepage": "https://github.com/atk4/data",
Expand All @@ -30,11 +31,11 @@
"atk4/dsql": "^2.0"
},
"require-dev": {
"atk4/schema": "^2.0",
"phpunit/phpunit": "<6",
"phpunit/dbunit": ">=1.2",
"phpunit/phpcov": "*",
"codeclimate/php-test-reporter": "*",
"atk4/schema": "^2.0"
"codeclimate/php-test-reporter": "*"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions docs/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ which I want to define like this::
return;
}

$this->owner->addField('created_dts', ['type'=>'datetime', 'default'=>date('Y-m-d H:i:s')]);
$this->owner->addField('created_dts', ['type'=>'datetime', 'default'=>new \DateTime()]);

$this->owner->hasOne('created_by_user_id', 'User');
if(isset($this->app->user) and $this->app->user->loaded()) {
Expand All @@ -170,7 +170,7 @@ which I want to define like this::
if(isset($this->app->user) and $this->app->user->loaded()) {
$data['updated_by'] = $this->app->user->id;
}
$data['updated_dts'] = date('Y-m-d H:i:s');
$data['updated_dts'] = new \DateTime();
});
}

Expand Down
32 changes: 24 additions & 8 deletions docs/model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ object you can load/unload individual records (See Single record Operations belo
$m->load(8);
....

and even perform operations on multiple records (See Multiple record Operations below)::
and even perform operations on multiple records (See `Persistence Actions` below)::

$m = new User($db);
$m->addCondition('expired', true);

$m->deleteAll();
$m->action('delete')->execute(); // performs mass delete, hooks are not executed
$m->each('delete'); // deletes each record, hooks are executed

When data is loaded from associated Persistence, it is automatically converted into
a native PHP type (such as DateTime object) through a process called Typecasting. Various
Expand Down Expand Up @@ -208,21 +210,20 @@ performance. In ATK Data this is not an issue, because "Model" is re-usable::

foreach(new User($db) as $user) {

var_dump($user->getField['name']);
// will be the same object every time!!
var_dump($user->getField['name']);


var_dump($user)
// this is also the same object every time!!
var_dump($user)

}

Instead, Field handles many very valuable operations which would otherwise fall on the
shoulders of developer (Read more here :php:class:`Field`)

.. php:method:: addField($name, $defaults)
.. php:method:: addField($name, $seed)
Creates a new field objects inside your model (by default the class is 'Field').
Creates a new field object inside your model (by default the class is 'Field').
The fields are implemented on top of Containers from Agile Core.

Second argument to addField() will contain a seed for the Field class::
Expand All @@ -234,14 +235,29 @@ the type::

$field = $this->addField('is_married', ['type'=>'boolean']);

// $field type is Field\Boolean
// $field class now will be Field\Boolean

You may also specify your own Field implementation::

$field = $this->addField('amount_and_currency', new MyAmountCurrencyField());

Read more about :php:class:`Field`

.. php:method:: addFields(array $fields, $defaults = [])
Creates multiple field objects in one method call. See multiple syntax examples::

$m->addFields(['name'], ['default' => 'anonymous']);

$m->addFields([
'last_name',
'login' => ['default' => 'unknown'],
'salary' => ['type'=>'money', CustomField::class, 'default' => 100],
['tax', CustomField::class, 'type'=>'money', 'default' => 20],
'vat' => new CustomField(['type'=>'money', 'default' => 15]),
]);


Read-only Fields
^^^^^^^^^^^^^^^^
Although you may make any field read-only::
Expand Down
34 changes: 17 additions & 17 deletions locale/en/atk.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?php

return [
'Field requires array for defaults' => 'Field requires array for defaults',
'Field value can not be base64 encoded because it is not of string type' => 'Field value can not be base64 encoded because it is not of string type ({{field}})',
'Mandatory field value cannot be null' => 'Mandatory field value cannot be null ({{field}})',
'Model is already related to another persistence' => 'Model is already related to another persistence',
'Must not be null' => 'Must not be null',
'Test with plural' => [
'zero' => 'Test zero',
'one' => 'Test is one',
'other' => 'Test are {{count}}',
],
'There was error while decoding JSON' => 'There was error while decoding JSON',
'Unable to determine persistence driver from DSN' => 'Unable to determine persistence driver from DSN',
'Unable to serialize field value on load' => 'Unable to serialize field value on load ({{field}})',
'Unable to serialize field value on save' => 'Unable to serialize field value on save ({{field}})',
'Unable to typecast field value on load' => 'Unable to typecast field value on load ({{field}})',
'Unable to typecast field value on save' => 'Unable to typecast field value on save ({{field}})',
'Record with specified ID was not found' => 'Record with specified ID was not found',
'Field requires array for defaults' => 'Field requires array for defaults',
'Field value can not be base64 encoded because it is not of string type' => 'Field value can not be base64 encoded because it is not of string type ({{field}})',
'Mandatory field value cannot be null' => 'Mandatory field value cannot be null ({{field}})',
'Model is already related to another persistence' => 'Model is already related to another persistence',
'Must not be null' => 'Must not be null',
'Test with plural' => [
'zero' => 'Test zero',
'one' => 'Test is one',
'other' => 'Test are {{count}}',
],
'There was error while decoding JSON' => 'There was error while decoding JSON',
'Unable to determine persistence driver from DSN' => 'Unable to determine persistence driver from DSN',
'Unable to serialize field value on load' => 'Unable to serialize field value on load ({{field}})',
'Unable to serialize field value on save' => 'Unable to serialize field value on save ({{field}})',
'Unable to typecast field value on load' => 'Unable to typecast field value on load ({{field}})',
'Unable to typecast field value on save' => 'Unable to typecast field value on save ({{field}})',
'Record with specified ID was not found' => 'Record with specified ID was not found',
];
32 changes: 16 additions & 16 deletions locale/it/atk.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?php

return [
'Field requires array for defaults' => 'Il campo richiede un array per i valori predefiniti',
'Field value can not be base64 encoded because it is not of string type' => 'Il valore del campo non può essere codificato in base64 perché non è di tipo stringa ({{field}})',
'Mandatory field value cannot be null' => 'Il valore del campo obbligatorio non può essere nullo ({{field}})',
'Model is already related to another persistence' => 'Il modello è già collegato a una persistenza',
'Must not be null' => 'Non deve essere nullo',
'Test with plural' => [
'zero' => 'Test zero',
'one' => 'Test è uno',
'other' => 'Test sono {{count}}',
],
'There was error while decoding JSON' => 'Si è verificato un errore durante la decodifica di JSON',
'Unable to determine persistence driver from DSN' => 'Impossibile determinare il driver di persistenza via DSN',
'Unable to serialize field value on load' => 'Impossibile serializzare il valore durante il caricamento ({{field}})',
'Unable to serialize field value on save' => 'Impossibile serializzare il valore durante il salvataggio ({{field}})',
'Unable to typecast field value on load' => 'Impossibile serializzare il valore durante il caricamento ({{field}})',
'Unable to typecast field value on save' => 'Impossibile serializzare il valore durante il salvataggio ({{field}})',
'Field requires array for defaults' => 'Il campo richiede un array per i valori predefiniti',
'Field value can not be base64 encoded because it is not of string type' => 'Il valore del campo non può essere codificato in base64 perché non è di tipo stringa ({{field}})',
'Mandatory field value cannot be null' => 'Il valore del campo obbligatorio non può essere nullo ({{field}})',
'Model is already related to another persistence' => 'Il modello è già collegato a una persistenza',
'Must not be null' => 'Non deve essere nullo',
'Test with plural' => [
'zero' => 'Test zero',
'one' => 'Test è uno',
'other' => 'Test sono {{count}}',
],
'There was error while decoding JSON' => 'Si è verificato un errore durante la decodifica di JSON',
'Unable to determine persistence driver from DSN' => 'Impossibile determinare il driver di persistenza via DSN',
'Unable to serialize field value on load' => 'Impossibile serializzare il valore durante il caricamento ({{field}})',
'Unable to serialize field value on save' => 'Impossibile serializzare il valore durante il salvataggio ({{field}})',
'Unable to typecast field value on load' => 'Impossibile serializzare il valore durante il caricamento ({{field}})',
'Unable to typecast field value on save' => 'Impossibile serializzare il valore durante il salvataggio ({{field}})',
];
30 changes: 15 additions & 15 deletions locale/ru/atk.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php

return [
'Field value can not be base64 encoded because it is not of string type' => 'Значение поля не может быть закодировано в base64, поскольку оно не имеет строкового типа ({{field}})',
'Mandatory field value cannot be null' => 'Обязательное значение поля не может быть пустым ({{field}})',
'Model is already related to another persistence' => 'Модель уже связана с другим постоянством',
'Test with plural' => [
'zero' => 'Тест ноль',
'one' => 'Тест один',
'other' => 'Тест {{count}}',
],
'There was error while decoding JSON' => 'Произошла ошибка при декодировании JSON',
'Unable to determine persistence driver from DSN' => 'Невозможно определить постоянство драйвера из DSN',
'Unable to serialize field value on load' => 'Невозможно сериализовать значение поля при загрузке ({{field}})',
'Unable to serialize field value on save' => 'Невозможно сериализовать значение поля при сохранении ({{field}})',
'Unable to typecast field value on load' => 'Невозможно установить тип поля при загрузке ({{field}})',
'Unable to typecast field value on save' => 'Невозможно сериализовать значение поля при сохранении ({{field}})',
'Record with specified ID was not found' => 'Запись с данным ID не найдена',
'Field value can not be base64 encoded because it is not of string type' => 'Значение поля не может быть закодировано в base64, поскольку оно не имеет строкового типа ({{field}})',
'Mandatory field value cannot be null' => 'Обязательное значение поля не может быть пустым ({{field}})',
'Model is already related to another persistence' => 'Модель уже связана с другим постоянством',
'Test with plural' => [
'zero' => 'Тест ноль',
'one' => 'Тест один',
'other' => 'Тест {{count}}',
],
'There was error while decoding JSON' => 'Произошла ошибка при декодировании JSON',
'Unable to determine persistence driver from DSN' => 'Невозможно определить постоянство драйвера из DSN',
'Unable to serialize field value on load' => 'Невозможно сериализовать значение поля при загрузке ({{field}})',
'Unable to serialize field value on save' => 'Невозможно сериализовать значение поля при сохранении ({{field}})',
'Unable to typecast field value on load' => 'Невозможно установить тип поля при загрузке ({{field}})',
'Unable to typecast field value on save' => 'Невозможно сериализовать значение поля при сохранении ({{field}})',
'Record with specified ID was not found' => 'Запись с данным ID не найдена',
];
2 changes: 1 addition & 1 deletion phpunit-pgsql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<php>
<var name="DB_DSN" value="pgsql:dbname=atk4-dsql-test;host=localhost" />
<var name="DB_USER" value="postgres" />
<var name="DB_PASSWD" value="" />
<var name="DB_PASSWD" value="password" />
<var name="DB_DBNAME" value="atk4-dsql-test" />
</php>
<filter>
Expand Down

0 comments on commit f916c24

Please sign in to comment.