CodeIgniter Forums
DataMapper ORM v1.8.0 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: DataMapper ORM v1.8.0 (/showthread.php?tid=37531)



DataMapper ORM v1.8.0 - El Forum - 02-25-2011

[eluser]Basketcasesoftware[/eluser]
[quote author="WanWizard" date="1298586884"]A new development version is available on bitbucket (https://bitbucket.org/wanwizard/datamapper/get/tip.zip), which implements most of the outstanding issues (both feature requests and bug fixes).[/quote]
Does this include documentation bugs? :-P


DataMapper ORM v1.8.0 - El Forum - 02-26-2011

[eluser]WanWizard[/eluser]
Yes, anything.

Offcourse, you can also fork the repo, make the changes yourself, and send me a pull request... Wink


DataMapper ORM v1.8.0 - El Forum - 02-26-2011

[eluser]Basketcasesoftware[/eluser]
[quote author="WanWizard" date="1298735585"]Yes, anything.

Offcourse, you can also fork the repo, make the changes yourself, and send me a pull request... Wink[/quote]

Anything, huh? Hmmm. I might call your bluff on that one. :-P

And a fork and pull? Not like I haven't done anything like that before. I'm still working on my Reactor fork yet. :ohh:


DataMapper ORM v1.8.0 - El Forum - 02-26-2011

[eluser]WanWizard[/eluser]
Gp ahead. Doesn't mean everything will be accepted though... Smile


DataMapper ORM v1.8.0 - El Forum - 02-27-2011

[eluser]gh0st[/eluser]
I'm wondering -- how do you get HMVC to work with DataMapper?

Let's say you have 2 entities, companies and employees with a 1->many relationship. Currently I am storing the models in the same module; but I want to split up my application into separate modules.

However, if I move my employees model file into the employee module datamapper can no longer find the file.

I tried changing the class parameter to a relative and a full-path but it doesn't work.

Code:
// Example
'class' => '/var/foo/bar/modules/employee/models/employee',

With this in mind, is it possible to combine Datamapper and the Modular Extensions - HMVC third-party plug-in?


DataMapper ORM v1.8.0 - El Forum - 02-28-2011

[eluser]WanWizard[/eluser]
Datamapper can autoload models from HMVC modules when using CI 2.0+ (or reactor), on the precondition that the module has been loaded (i.e. the module path should be known).

You can add a module path manually by using
Code:
$this->load->_add_module_paths($module);



DataMapper ORM v1.8.0 - El Forum - 02-28-2011

[eluser]Basketcasesoftware[/eluser]
Any way of automating that in the next DM patch? Is it even possible? I'm glad this question came up because I wasn't even aware of this issue.


DataMapper ORM v1.8.0 - El Forum - 03-01-2011

[eluser]WanWizard[/eluser]
How would you automate that? DM doesn't know up front what you intend to load, nor where the HMVC models are located.

@Wiredesignz added DM support in v5.3 (I think), but only for the currently loaded module, so you can use DM models inside an HMVC request. Calling the add_module_paths() method is a workaround, given the underscore prefix you're not supposed to use it I guess.

Alternatively you can use DM's own config to specify extra paths to search through. Or use your own logic to add paths to $this->load->_ci_model_paths, for example through a loader extension.


DataMapper ORM v1.8.0 - El Forum - 03-01-2011

[eluser]gh0st[/eluser]
Thanks a lot WanWizard.


DataMapper ORM v1.8.0 - El Forum - 03-02-2011

[eluser]Basketcasesoftware[/eluser]
[quote author="WanWizard" date="1298987922"]How would you automate that? DM doesn't know up front what you intend to load, nor where the HMVC models are located.

@Wiredesignz added DM support in v5.3 (I think), but only for the currently loaded module, so you can use DM models inside an HMVC request. Calling the add_module_paths() method is a workaround, given the underscore prefix you're not supposed to use it I guess.

Alternatively you can use DM's own config to specify extra paths to search through. Or use your own logic to add paths to $this->load->_ci_model_paths, for example through a loader extension.[/quote]

Yeah, I figured that would be the issue. Notice I even directly asked if was even possible to do it. Kinda hoped for the best on that one. :cheese: