Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement #386 #477

Merged
merged 11 commits into from
Nov 26, 2019
Merged

Implement #386 #477

merged 11 commits into from
Nov 26, 2019

Conversation

DarkSide666
Copy link
Member

@DarkSide666 DarkSide666 commented Nov 22, 2019

Implements #386 (fix #386).

  • introduce Helper class as a place to put some shared functionality which is used in multiple classes
  • Helper::readableCaption($s) now is used everywhere to generate model, field or action captions from object class names, field names or any other string. It also is aware of camelCase words now!
  • added testcases

For example, this ugly string
this\\ _isNASA_MyBigBull shit_123\Foo
will be translated into nice looking, human readable caption
This Is NASA My Big Bull Shit 123 Foo

@codecov
Copy link

codecov bot commented Nov 22, 2019

Codecov Report

Merging #477 into develop will decrease coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop     #477      +/-   ##
=============================================
- Coverage      86.78%   86.73%   -0.06%     
+ Complexity      1214     1212       -2     
=============================================
  Files             28       28              
  Lines           2672     2661      -11     
=============================================
- Hits            2319     2308      -11     
  Misses           353      353
Impacted Files Coverage Δ Complexity Δ
src/Field.php 78.2% <100%> (-0.14%) 95 <0> (-2)
src/Model.php 91.29% <100%> (-0.12%) 354 <0> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 98a7c46...c449ba8. Read the comment docs.

$s = ucwords(preg_replace('/[^a-z0-9]+/i', ' ', $s));

// and then run regex to split camelcased words too
$s = array_map('trim', preg_split('/^[^A-Z\d]+\K|[A-Z\d][^A-Z\d]+\K/', $s, -1, PREG_SPLIT_NO_EMPTY));
Copy link
Member

@romaninsh romaninsh Nov 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this should go to ATK Core, as a trait.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implemented

Copy link
Member

@romaninsh romaninsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move this into atk core.

Copy link
Member

@romaninsh romaninsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great, just re-run the test after a bit.

@DarkSide666 DarkSide666 merged commit 2437143 into develop Nov 26, 2019
@DarkSide666 DarkSide666 deleted the feature/implement-386 branch November 26, 2019 17:54
romaninsh pushed a commit that referenced this pull request Dec 2, 2019
* 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

* Setting current dependencies
DarkSide666 added a commit that referenced this pull request Feb 11, 2020
* 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>
DarkSide666 added a commit that referenced this pull request Apr 8, 2020
* 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

* Fix hasOne relation seed processing. It should replace not merge. (#512)

* New method $model->getTitles() (#513)

* Implement `getTitles()` method

* Apply fixes from StyleCI

* Update unit-tests.yml

* migration to migrator

* rename addHook to onHook (#514)

* fix #944 (#516)

* allow dots in table names, fix #515, fix #517

* Apply fixes from StyleCI

* Do not fail-fast PHP test matrix (#522)

* Simplify code (#519)

* Update release-drafter.yml

* Update release-drafter.yml

* Fix hook trait usage (#525)

* Hook args must be an array

* Fix hook onHook() usage

* Implement addWith() (#527)

* Implement addWith()

* Apply fixes from StyleCI

* implement `addWith`

* add docs

* add note

* Update unit-tests.yml

* Update unit-tests.yml

* Update unit-tests.yml

* Update unit-tests.yml

* Update unit-tests.yml

* Update unit-tests.yml

* Update unit-tests.yml

* Update unit-tests.yml

* Update unit-tests.yml

* Update unit-tests.yml

* Update unit-tests.yml

* Action should also support `fields===true` value (#531)

* Fix LIKE conditions for Array and SQL persistences (#532)

* Fix LIKE conditions - fix fix (#535)

* fix #533 (#537)

* Fix value trim (#538)

* introduce sql null condition test (#540)

* introduce test on condition with null value

* include mesage in SQL exception details

* Fix typo

* Convert scalar class names to ::class (#544)

* Fix CS - do not import classes without namespace

* Use null coalescing operator instead of isset (#545)

* Use null coalescing operator instead of isset

* Fix tests

* Fix refactorability for "owner" (#543)

* Fix refactorability for "owner"

* Typehint for elements

* Narrow phpdoc for SQL subtypes

* Fix typos

* Setting release dependencies

Co-authored-by: Romans Malinovskis <romans@agiletoolkit.org>
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: DarkSide <imants.horsts@inbox.lv>
Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>
Co-authored-by: GitHub Action <noreply@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Convert camel case field names to captions in model
2 participants