deconstruct unknown date/time arrays to be able to properly use them in ... #842

wants to merge 2 commits into


None yet
5 participants
@@ -1210,14 +1210,26 @@ protected function _normalizeXmlData(array $xml) {
* @param string $field The name of the field to be deconstructed
* @param array|object $data An array or object to be deconstructed into a field
+ * @param string $type The field type to manually overwrite the automatic detection or schema default

ADmad Sep 14, 2012



+ if (isset($data['hour']) || isset($data['min']) || isset($data['sec'])) {
+ $type .= 'time';
+ }
+ }

markstory Sep 14, 2012


I dunno about this. Seems like moar magic which has the potential of going wrong. Like ADmad said in the lighthouse ticket couldn't you just setup the schema or specify the types when using deconstruct. In the past when we've had code that does guessing it generally ends up being wrong.

@@ -1167,6 +1167,68 @@ public function testDeconstructFieldsDateTime() {
+ * testDeconstructFields with unkown datetime fields

shama Sep 14, 2012


Small typo /unkown/unknown/ :)


lorenzo Sep 14, 2012


I agree with mark, adding more magic like this is not going to be good in
the long term. You can just easily override getColumnType or your schema to
return whatever you want.


ADmad commented Sep 14, 2012

Since none of the devs seem to be in favor of this, I am closing the PR and the ticket.

@ADmad ADmad closed this Sep 14, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment