thomshouse-escher / escher

Escher was a PHP MVC framework developed by Thom Stricklin from 2011-2013. Escher implemented a hybrid of Model2 MVC and PAC architectures and CMS concepts as well as plugins and configuration wizards. Development halted in 2013 in favor of Kohana and later Symfony, which closely aligned to the same design principles as Escher.
http://git.io/escher
4 stars 1 forks source link

DB Datasource not saving #71

Closed adetwiler closed 12 years ago

adetwiler commented 12 years ago

Datasources won't save if "array" schema types are used.

thomshouse commented 12 years ago

A datasource will save if arrays are used in array schema types.

A model will not save if an object is passed in lieu of an array.

I don't really consider this a bug. The schema field type is array, not object. Javascript (and JSON) don't really make a distinction between hash arrays, typed and untyped objects. PHP does. Because of this, JSON-stored data can only be decoded into one form--array or stdClass--and there's no way to tell which would be "correct" in terms of the pre-encoded data.

Edit: There is an incoming bugfix which will decode arrays as arrays properly, not as stdClass objects. With that in mind, I think it's reasonable to only accept arrays on save, since you will only ever get arrays on load.