Jump to content

Junction -- PHP 5 ORM


Buyocat

Recommended Posts

Looks like you guys have made some headway. Some questions:

 

  • What do you do when an object's props don't directly map to table fields?
  • How do you handle object structures?
  • Do you put any requirements on the business objects (like getters and setters or public props)? Or;
  • Do you have the business objects dependent on the DAO (the object uses a DAO to do CRUD operations)?
  • Are there any example uses?
  • Are there any facilities to generate metadata?
  • Are there any safeguards to prevent RDBMS transaction/business transaction desync?

 

These are some of the questions I have asked about my own persistence layer, so I would love to get your view on them.

Link to comment
Share on other sites

I'm not going to answer all of your questions here, but I'll try to answer the easier/important ones.

 

1) Properties which don't make directly to fields.

We call public getters and setters so there doesn't need to be an actual single property which corresponds to a table.  For instance, you could easily combine several properties in an object and return the result in some mapped getter.

 

2) Object structures?

If you mean collections (such as a collection of emails which are dependent on a user object) that isn't yet implemented.  That is the biggest feature which we are starting to look at now.

 

3) Data object requirements

It must have a public constructor which either takes no parameters or has default values.  For each property defined in the metadata file a public get and set property method is required.  That's it.

 

4) Please check out the code which has some sample uses included.  Also see the hosted code's wiki.

 

5) No tools exist to generate the metadata or data objects, but I've thought about it as a feature for the future (but it's lower priority).

 

6) Transactions are another big feature that we need to implement.

 

One thing on the business objects, Junction really is expecting a data object, not a business object.  By that I mean that the getting and setting is expected to return the value mostly as-is.  For instance, if you had a User object with a setPassword() which hashed the password, that would lead to problems.  In order to get a real business object you would need wrap around the data object.  I have a sample User business object which I can (and will) publish on the hosted wiki.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.