kaliop-uk / ezmigrationbundle

This bundle makes it easy to handle eZPlatform / eZPublish5 content upgrades/migrations
GNU General Public License v2.0
53 stars 81 forks source link

issue-224: add support for ezcountry field #225

Closed crevillo closed 4 years ago

crevillo commented 5 years ago

Adds support for ez country field allowing entering either a single alpha2 (for non multiple calues cases) or an array of codes for the case the field allows multiple values

crevillo commented 5 years ago

about your comments 1.- yeah. indeed. i'll work on that too 2.- step by step i guess :). at first i choose de alpha2 mainly because that's normally the same as the key in the ez parameter 3.- can you paste here an example of the struct you're talking about?

crevillo commented 5 years ago

There seems to be also a test where some ezcountry field was trying to be added. looks it tried to cover more options as country name and alpha3.

https://github.com/kaliop-uk/ezmigrationbundle/blob/master/Tests/dsl/good/UnitTestOK004_content.yml#L335

Did it work before even no handler for the field?

gggeek commented 5 years ago

"Did it work before even no handler for the field?" => I am not sure whet it did, but it surely did not throw :-D

crevillo commented 5 years ago

lol. so, time to fix the code. tdd at its best! so, how do you sugget to implement this? maybe depending on the long of (each) value and some kind of array_search?

codecov-io commented 5 years ago

Codecov Report

Merging #225 into master will increase coverage by 0.04%. The diff coverage is 91.66%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #225      +/-   ##
============================================
+ Coverage     68.04%   68.08%   +0.04%     
- Complexity     2637     2641       +4     
============================================
  Files           124      125       +1     
  Lines          6865     6877      +12     
============================================
+ Hits           4671     4682      +11     
- Misses         2194     2195       +1
Impacted Files Coverage Δ Complexity Δ
Core/FieldHandler/EzCountry.php 91.66% <91.66%> (ø) 4 <4> (?)

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 4bc51dc...c6aa195. Read the comment docs.

crevillo commented 5 years ago

running travis after rebase. before rebasing everything was green. let me know if you miss anything.

crevillo commented 5 years ago

Refactored now to use fromHash method from the fieldtype.

crevillo commented 5 years ago

i had to delete the country idc from the test. the fromHash method of the country fieldtype doesn't work with ids.

We could restore some of the previous code to have the search as before to allow this possibility too. Thoughts?