nathggns / Scaffold

Lightweight PHP API Framework
Other
8 stars 2 forks source link

Relationship columns #127

Closed nathggns closed 11 years ago

nathggns commented 11 years ago

Should the column used to create the relationship be removed in exported data if the relationship is also exported? Seems like irrelevant data. Maybe make it an option at the class or method level?

ClaudioAlbertin commented 11 years ago

You mean foreign keys? Remove them by default, there should be a method to keep them on query- and model-level.

ClaudioAlbertin commented 11 years ago

Actually we might want to keep them. Nobody has to use them, if they don't want to. However if they want to, they shouldn't be required to take extra steps.

nathggns commented 11 years ago

I mean, on export, at least. It's just a bit weird to have like user_id and them an id inside user. — Nathaniel Higgins http://nath.is

On Sat, Jun 1, 2013 at 11:03 PM, Claudio Albertin notifications@github.com wrote:

You mean foreign keys? Remove them by default, there should be a method to keep them on query- and model-level.

Reply to this email directly or view it on GitHub: https://github.com/Scaffold/Scaffold/issues/127#issuecomment-18797832

ClaudioAlbertin commented 11 years ago

What does exporting even do? Where is the data used?

nathggns commented 11 years ago

Exporting takes a model and turns it into an array.  — Nathaniel Higgins http://nath.is

On Sat, Jun 1, 2013 at 11:06 PM, Claudio Albertin notifications@github.com wrote:

What does exporting even do? Where is the data used?

Reply to this email directly or view it on GitHub: https://github.com/Scaffold/Scaffold/issues/127#issuecomment-18797881

ClaudioAlbertin commented 11 years ago

Do models use lazy-loading for (first-level) relationships? The export function should certainly take a level argument, and I think it should default to 0 (no relationships contained in the export).

nathggns commented 11 years ago

It defaults to 1, which means that first level relationships are exported. Everything in Models are lazy loaded.  — Nathaniel Higgins http://nath.is

On Sat, Jun 1, 2013 at 11:12 PM, Claudio Albertin notifications@github.com wrote:

Do models use lazy-loading for (first-level) relationships?

The export function should certainly take a level argument, and I think it should default to 0 (no relationships contained in the export).

Reply to this email directly or view it on GitHub: https://github.com/Scaffold/Scaffold/issues/127#issuecomment-18797957

ClaudioAlbertin commented 11 years ago

Default to 0. It makes more sense to me to start with nothing than in the middle basically, with 1.

nathggns commented 11 years ago

Hm. We have an actual user that wants first level relationships to export. @andrewhathaway — Nathaniel Higgins http://nath.is

On Sat, Jun 1, 2013 at 11:15 PM, Claudio Albertin notifications@github.com wrote:

Default to 0. It makes more sense to me to start with nothing than in the middle basically, with 1.

Reply to this email directly or view it on GitHub: https://github.com/Scaffold/Scaffold/issues/127#issuecomment-18798016

ClaudioAlbertin commented 11 years ago

That might be, but then he can simply give the wanted level as an argument to export.

nathggns commented 11 years ago

Set the default as a property on the model maybe? — Nathaniel Higgins http://nath.is

On Sat, Jun 1, 2013 at 11:18 PM, Claudio Albertin notifications@github.com wrote:

That might be, but then he can simply give the wanted level as an argument to export.

Reply to this email directly or view it on GitHub: https://github.com/Scaffold/Scaffold/issues/127#issuecomment-18798071

ClaudioAlbertin commented 11 years ago

I think it makes a lot more sense to set it on request. The export() method requests data after all, and a request has to specify options.

nathggns commented 11 years ago

Yes, but it has to default to one or the other, so having it as a property just gives the class the ability to change the default. I don't see the harm there. — Nathaniel Higgins http://nath.is

On Sat, Jun 8, 2013 at 7:13 PM, Claudio Albertin notifications@github.com wrote:

I think it makes a lot more sense to set it on request. The export() method requests data after all, and a request has to specify options.

Reply to this email directly or view it on GitHub: https://github.com/Scaffold/Scaffold/issues/127#issuecomment-19152935

ClaudioAlbertin commented 11 years ago

It's pointless. Don't add pointless stuff. Also it would result in a "I feel lucky" type of export, you never know what you're actually going to get. Don't do this.

nathggns commented 11 years ago

I guess. What should be the default?  — Nathaniel Higgins http://nath.is

On Sat, Jun 8, 2013 at 8:31 PM, Claudio Albertin notifications@github.com wrote:

It's pointless. Don't add pointless stuff. Also it would result in a "I feel lucky" type of export, you never know what you're actually going to get. Don't do this.

Reply to this email directly or view it on GitHub: https://github.com/Scaffold/Scaffold/issues/127#issuecomment-19154118

nathggns commented 11 years ago

Just remove this. Silly idea.