Object is not instantiated for deep relationships in Codeigniter DataMapper ORM

From this example:

http://datamapper.wanwizard.eu/pages/getadvanced.html#Deep.Relationship.Include

You can see that it says: At this time, deep relationships do not support instatiation..

So if we have some methods defined in the Group model, it still can't be used unless we manually collect the field data and instantiate the group object ourselves.

I am interested in why it's not supported, is this something very difficult to achieve for an ORM?

Also, I would very much like to know if there is any easy workaround or how you solved this problem.

Answers


You can instantiate related objects when you use include_related(), but you can not instantiate deep relations ( like include_related('groups/users/posts/comments') ), the code simply doesn't support it.

Remember that DataMapper has been around for quite a few years, and the current v1.x codebase still supports CodeIgniter 1.7. Which means it contains a fair amount of PHP4 legacy code.

I'm busy designing DataMapper v2, which will address this issue.


Need Your Help

Packaging Unix utilities as part of a Cocoa App

cocoa unix distribution packaging

I'm currently writing a Cocoa app that uses pdftotext from xpdf, which I personally have because of homebrew.

Why does this wordpress code throw an empty WPDB error?

mysql wordpress-plugin wordpress

I'm writing a feed reader plugin for wordpress. I'm seeing a DB error that I can't figure out.