Skip to content

Conversation

@dereuromark
Copy link
Member

… again.

Resolves #46

The main problem is Hash::extract() and that it converts the date into an array upon lookup.
The isset($x[0]) check cannot work on an array that is

[
    'date' => ....,
    ....
]

So this fixes it but for every other object it will most likely fail, Maybe the array transformation should not be happening for objects in Hash::extract()? Or there should be a to string cast instead.
Either way, this PR at least now solves our specific issue at hand.

I tested it in my sandbox:
http://sandbox3.dereuromark.de/sandbox/csv/pagination
Currently the datetime fields would be indeed just gone, but as soon as this is merged, I will update the examples and you can see that it works as expected.

@dereuromark
Copy link
Member Author

Locally, the tests passed (no .000000 noise added).
What shall we do? Is there a way to safely and consistently output just the datetime value?

@dereuromark
Copy link
Member Author

@savant How shall we proceed?

@dereuromark
Copy link
Member Author

Non-travis (windows, ubuntu, ...) it is always:

Time: 242 ms, Memory: 22.75Mb
OK (10 tests, 23 assertions)

@josegonzalez
Copy link
Member

It might be the default datetime format on travis is being set to ISO8601? Not sure how to force it to be one or the other...

@dereuromark
Copy link
Member Author

If we could fix the core issue about how objects are being returned in array form instead of keeping the DateTime object as a whole we could resolve this at the root :)
As it would also properly toString() then including the expected (localized) output.

@dereuromark
Copy link
Member Author

Yeah I got it! 🎱

josegonzalez added a commit that referenced this pull request Jan 20, 2016
Fix CakePHP date(time) object values to be not destroyed but exported…
@josegonzalez josegonzalez merged commit ef829a0 into master Jan 20, 2016
@josegonzalez josegonzalez deleted the master-date branch January 20, 2016 20:59
@josegonzalez
Copy link
Member

Now all you have to do is write more tests to increase our coverage ;)

@dereuromark
Copy link
Member Author

@josegonzalez
Copy link
Member

The bom stuff was never tested.

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.

Date fields exported as NULL

4 participants