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

Fix config trait file bad format #98

Merged
merged 8 commits into from
Jun 26, 2019

Conversation

abbadon1334
Copy link
Collaborator

i make a draft for documentation of ConfigTrait ( ref : #87 )
in my project as i show you last week, i extensively use ConfigTrait with DefinitionTrait ( You will see it in a next PR ).
If you try to load an empty file, you will get an error and not an exception on :

https://github.com/atk4/core/blob/develop/src/ConfigTrait.php#L83

because $tempConfig is not an array, to avoid that i add a check against type array and raise exception if not.

@codecov
Copy link

codecov bot commented Jun 20, 2019

Codecov Report

Merging #98 into develop will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop      #98      +/-   ##
=============================================
+ Coverage      99.43%   99.43%   +<.01%     
- Complexity       301      302       +1     
=============================================
  Files             14       14              
  Lines            705      710       +5     
=============================================
+ Hits             701      706       +5     
  Misses             4        4
Impacted Files Coverage Δ Complexity Δ
src/ConfigTrait.php 100% <100%> (ø) 24 <0> (+1) ⬆️

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 deb93aa...460db70. Read the comment docs.


if you need an element that is declared inside an array you can use a special syntax :

$object->getConfig('level1_array/level2_array/element_key','if not defined use this as default');
Copy link
Member

Choose a reason for hiding this comment

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

i think we should also provide a good guideline on how 3rd party add-ons should use their class as a top level element key.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Translator implementation for sure will need it and can be created as an addon.

At this moment the TranslatableTrait return translations already written in codebase, using an addon we can extract all this "tokens" and define it as an addon.

I think we probably need a composer script or a console command that create the folder in the project for you when add the addon.

next thursday we can speak about how can be implemented addons when need extra config, like we have done with actions, the results was really good.

docs/config.rst Outdated Show resolved Hide resolved
@romaninsh romaninsh merged commit 782e1d1 into atk4:develop Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants