Welcome Guest, Not a member yet? Register   Sign In
[Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition)
#1

[eluser]OverZealous[/eluser]
This is an outdated version. Please see the newer version here.

DataMapper OverZealous Edition 1.5.4

Quote: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.
#2

[eluser]OverZealous[/eluser]
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.
#3

[eluser]umefarooq[/eluser]
really nice work i like the DM but one question is that same like model we are getting values using

Code:
$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.
#4

[eluser]OverZealous[/eluser]
[quote author="umefarooq" date="1256132118"]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.[/quote]

The second result when searching for $_POST in the documentation leads you to Associative Array Conversion Methods, an extension that:
Quote: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.
#5

[eluser]umefarooq[/eluser]
wow that really cool let me try it properly. i was just checking the documentation thanks for quick reply
#6

[eluser]benoa[/eluser]
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...
#7

[eluser]OverZealous[/eluser]
@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.
#8

[eluser]benoa[/eluser]
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...
#9

[eluser]Benedikt[/eluser]
From my understanding you would:
a) Set
Code:
var $has_many("request")
in User-Model.
b) Set
Code:
var $has_one("user")
in Request-Model.

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

Code:
$u = new User();
$u->request->get();
foreach ($u->request->all as $request) {
   ...
}
#10

[eluser]benoa[/eluser]
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?




Theme © iAndrew 2016 - Forum software by © MyBB