Closed flip111 closed 8 years ago
This is difficult, how should RedBeanPHP determine which fields belong to the bean and which don't without storing a schema definition or parsing the query?
storing a schema definition would be acceptable. another solution which i don't prefer is to let redbean know how many fields should be put in meta when making the query. (extra fields should be put last). It's it correct to say that redbean can only work with one type of bean per row? and not type1., type2. ??
one of the selling points of RedBeanPHP is that it doesnt need to keep track of any schema.
Maybe we could prefix fields in the query using aliasing 'meta_' ?
Good idea :+1:
This is a bit OffTopic but, what about building an object graph from a query with a bunch of different tables? I'm sure that has come up along the way somewhere, what's your stance on that?
When redbean is not in freeze mode it keeps tracks of schema all the time actually. When it's frozen it could write out schema data to a php file and just include the file, it's very fast. Maybe some of these sorts of functionalities are better placed in plugins.
meta mask has been implemented in master.
what will happen if the name of the variable is the same as things that are already considered metadata?
The meta data is namespaced, 'data.bundle' a collision is highly unlikely but it will simply overwrite the old data.
offtopic: I see you like to play with parser, opcodes etc. Have you seen my other project, you might want to join.. https://github.com/gabordemooij/citrine
That's quite the undertaking you got going on there, i saw it before it looks interesting. Perhaps you can showcase a few things on the website which were made with Citrine? Personally i'm trying to move away from imperative code into the functional land.
Functional and OO are very close actually. Smalltalk was inspired by Lisp. Citrine brings the two back together as originally intended by Alan Kay. Object oriented programming is just 'functional programming without the need for types' - because your functions are bound to the types already.
Besides Citrine is capable of mimicking functional paradigms, it supports closures and higher order functions - all without the need to change it's semantics, it's just a natural part of its design.
Could
convertToBeans
allow additional columns to be put as meta data on the bean? This way you could dothen in php