[Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) |
[eluser]apersaud[/eluser]
Hi OverZealous, I'd like to contribute some code that I've added to my DMZ 1.2.1 to make it easier working your objects as Arrays. I'm building an JSON based API for my website (Addicted2Salsa) and came across an issue. Code: //only an example of Addicted2Salsa episodes What I added were simple methods to my Models so that I can convert them to arrays with only the fields I would like to make available. Code: //only an example of Addicted2Salsa episodes Code: //example 2 (a bit more complicated) Since I've been adding it to most of my DMZ models (maybe because I haven't found a better way of doing it), I thought it would be a good idea to contribute it and let you take a look at it. I added a public toArray() which will convert the DMZ object to an Array given the column fields of the object. I have Code: /* In Episode class which extends DataMapper */ I think this might be useful to include some similar functionality in DMZ. These were my 2 cents. :-) Let me know what you think. |
Welcome Guest, Not a member yet? Register Sign In |