Part of the EllisLab Network
   
1 of 20
1
[Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition)
Posted: 21 October 2009 02:38 AM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1041
Joined  10-08-2008

This is an outdated version.  Please see the newer version here.

DataMapper OverZealous Edition 1.5.4

Download the Latest Version Here

  View the change log and the upgrade process
  Having issues? Please look through the Troubleshooting Guide & FAQs
  View the Complete Manual
  Search the Manual NEW!

DataMapper (DM) is an Object-Relational Mapper that builds on ActiveRecord.  Data is loaded from database tables into objects, and relationships can be managed through simple, easy-to-read functions.

DataMapper OverZealous Edition (DMZ) adds several important features to DM, enhancing it’s usage, usually without requiring any code changes.

To install DMZ over DataMapper, the (fairly simple) upgrade process is described here.

DMZ offers these features and more over the original DataMapper:
  • In-table foreign keys
  • Multiple relationships to the same model
  • Better self references
  • Add fields from a related model into one query
  • Update, view, and query extra columns on join tables
  • A shareable extension mechanism, including:
      • Easy creation of HTML forms,
      • Processing posted input,
      • Converting to-and-from JSON, CSV, and arrays, and
      • Query caching

Version 1.5.4:
Minor bugfix for related validation, fixed dead links in docs.

Also, I am going to start a new thread for each DMZ release from now on, to prevent the very large threads from the past.

The older version was discussed here.

Thanks goes to stensi, for providing such an amazing code base to work on.

 Signature 

Phil DeJarnett
  OverZealous Creations, LLC

Profile
 
 
Posted: 21 October 2009 03:32 AM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1041
Joined  10-08-2008

FYI: I updated the manual to be searchable, using a custom Google search.

The Google search also includes results from this forum thread, as well as the older forum thread.

Feel free to check it out in the upper-right hand corner of any page in the documentation.

 Signature 

Phil DeJarnett
  OverZealous Creations, LLC

Profile
 
 
Posted: 21 October 2009 04:35 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  743
Joined  09-11-2008

really nice work i like the DM but one question is that same like model we are getting values using

$this->input->post('name'); 

is there any way we just pass $_POST and it will update or insert the data in table just like joomla and already we are defining all table columns in validation array. for select data from table we can get value and then pass to the DM.

 Signature 

CI,JQuery,Google Maps | widget with CI loader | Thumbnail, Image Resize, Image Crop Helper | CI shortcode

Profile
 
 
Posted: 21 October 2009 04:38 AM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1041
Joined  10-08-2008
umefarooq - 21 October 2009 08:35 AM

is there any way we just pass $_POST and it will update or insert the data in table just like joomla and already we are defining all table columns in validation array. for select data from table we can get value and then pass to the DM.

The second result when searching for $_POST in the documentation leads you to Associative Array Conversion Methods, an extension that:

Converts an object to and from associative arrays. The to_array method can be used directly with $_POST for rapid saving of HTML forms. When combined with the HTML Form Generation Methods, this extension can make creating simple content mangement tools very easy.

 Signature 

Phil DeJarnett
  OverZealous Creations, LLC

Profile
 
 
Posted: 21 October 2009 04:58 AM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  743
Joined  09-11-2008

wow that really cool let me try it properly. i was just checking the documentation thanks for quick reply

 Signature 

CI,JQuery,Google Maps | widget with CI loader | Thumbnail, Image Resize, Image Crop Helper | CI shortcode

Profile
 
 
Posted: 21 October 2009 06:34 AM   [ Ignore ]   [ # 5 ]  
Grad Student
Rank
Total Posts:  47
Joined  02-13-2009

It’s nice you still working on that golden piece of code! That’d be very nice if you could provide a patch of the modified files form 1.5.3…

Thank you for making CI even better! Since I use your ORM, I miss ROR a bit less…

Profile
 
 
Posted: 21 October 2009 06:38 AM   [ Ignore ]   [ # 6 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1041
Joined  10-08-2008

@benoa
Do you mean this? Upgrade Instructions

DMZ has a “lite” download option for those who are just upgrading.  It only includes the core library files, and none of the extras.

There is no patching, just replace the files.  You shouldn’t have to edit the DMZ library directly.  All changes are also documented in the change log.

 Signature 

Phil DeJarnett
  OverZealous Creations, LLC

Profile
 
 
Posted: 21 October 2009 07:31 AM   [ Ignore ]   [ # 7 ]  
Grad Student
Rank
Total Posts:  47
Joined  02-13-2009

Sorry, my bad…!
____________________________________________________________________

There is some stuff I don’t get about relashionships… Could you help me please? In my application there are three tables `users`, `requests`, `users_requests`, but I don’t know how to get them glued into DMZ :S

Basically one user can send/receive multiple requests. Requests can only (and must) have one sender && one receiver.

So I’m building two Models: User and Request.

The `users_requests` would be the join table that bring them altogether.

I’ve been through the docs, and apparently it is possible to join the two objects through a join table without me having to build the Users_Requests class, but I have no idea how to put it into real code… That’d be very nice if you could post an example of how it should look…

Profile
 
 
Posted: 21 October 2009 08:01 AM   [ Ignore ]   [ # 8 ]  
Grad Student
Avatar
Rank
Total Posts:  97
Joined  08-29-2007

From my understanding you would:
a) Set

var $has_many("request"

in User-Model.
b) Set

var $has_one("user"

in Request-Model.

Now you can do the following to get the User’s requests:

$u = new User();
$u->request->get();
foreach (
$u->request->all as $request{
   
...
 Signature 

Visit the german-speaking CI-community at http://codeigniter.ch
FreeBSD- and Server-Tutorials at http://serverzeit.de
The event-calendar for Mini-Drivers at http://miniyourlife.com

Profile
 
 
Posted: 21 October 2009 08:10 AM   [ Ignore ]   [ # 9 ]  
Grad Student
Rank
Total Posts:  47
Joined  02-13-2009

Hey Benedikt, thanks for taking the time to read and answer my post smile

This is my database schema :

users: id | username | email | (etc..)
requests: id | sender | receiver
user_requests: user_id | request_id

Will the code you provided work with that?

Profile
 
 
Posted: 21 October 2009 08:15 AM   [ Ignore ]   [ # 10 ]  
Grad Student
Avatar
Rank
Total Posts:  97
Joined  08-29-2007

No.

The join-table needs to be users_requests (missing s after user, maybe typo).

But besides it should work.
I also have my problems in understanding DM, but the support is not very good. Maybe you want to look at Doctrine.

 Signature 

Visit the german-speaking CI-community at http://codeigniter.ch
FreeBSD- and Server-Tutorials at http://serverzeit.de
The event-calendar for Mini-Drivers at http://miniyourlife.com

Profile
 
 
   
1 of 20
1