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

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



DataMapper OverZealous Edition 1.6.2

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!
(Due to the server's caching configuration, you may need to forcibly refresh your browser to see the changes in the manual.)

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
The ability to generate and use subqueries
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.6.2:
NOTE: 1.6.2 includes a minor bugfixes. There are no changes to the core DMZ library.

If you are upgrading from 1.5.x or earlier, this is a major change. There is a good chance DMZ 1.6 could break existing code.

The major changes in this version revolve around the db object. Previously, a single DataBase object was created for the entire application. Changes to any $object->db would affect all other objects, widgets, and whatevers.

DMZ 1.6 introduces a dynamically created DB object. A new one is created every time a query is needed. There are several important reasons for this:

1. Multiple queries can be built simultaneously. If one large query is being built, and needs the results of a different query, it is safe to build, run, and process a second query, without affecting the original.
2. The multiple query functionality makes it possible to create subqueries using the existing Active Record methods. This is very powerful, as you can build the query on the other object, then easily include it in your main query.
3. Subqueries allow DMZ to calculate and include the number of related objects along-side the main object being queried.
4. While not tested, it should be easier that ever to work with multiple databases simultaneously. (You won't be able to query across them, but no more hacking to get a different DB for different objects!) See db_params on this page.

The dynamic DB can be disabled, but all of the above will no longer work.

Besides this, DMZ 1.6 includes several other new features:
SQL Functions and expressions can be built using AR-like methods, as well as used in SELECT and query statements.
• You can get the text of a query without running it using get_sql.
• There is a new virtual validation rule, always_validate, that can be used to override the default behavior of ignoring non-required empty fields.

----------

Older Discussions: Version 1.5.4, Version 1.5.3 and older.

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

[eluser]OverZealous[/eluser]
I'm releasing DMZ 1.6.0 now. Since this is a long holiday weekend here in the United States, I will not be able to provide help right away if you come across any bugs.

However, please feel free to give it a once-over, take it for a test drive, and all that. If you find any problems, post a message on this forum. I'll try to look them over next week.

Also, I've been very busy lately (these updates were ready in mid-October!), so I might have forgotten to include requests from the previous forum. If so, leave a note here, and I'll try to remember next time. Tongue
#3

[eluser]Mirage[/eluser]
Phil, awesome release. I can take advantage of the validation enhancements right away. Looking forward to trying out all of the other cool stuff. Stand by for silly questions. :-)

Have a great holiday!
-m
#4

[eluser]The Hamburgler[/eluser]
Great work Phil, I'll be trying out the dynamically created DB object asap.

I've had problems with building multiple queries before but just hacked a workaround.

Don't know why I never considered this solution!
#5

[eluser]OverZealous[/eluser]
[quote author="The Hamburgler" date="1259091824"]
I've had problems with building multiple queries before but just hacked a workaround.

Don't know why I never considered this solution![/quote]

That's funny, 'cause that's what I was thinking when I realized I could so easily create new DB objects! It's incredibly clean, and once I realized how much I could get away with (such as the sub query stuff), I was quite pleased with the result.

Now, to eventually walk through my code base and rip out all the hard-coded stuff. Tongue
#6

[eluser]The Hamburgler[/eluser]
[quote author="OverZealous" date="1259101765"][quote author="The Hamburgler" date="1259091824"]
I've had problems with building multiple queries before but just hacked a workaround.

Don't know why I never considered this solution![/quote]

That's funny, 'cause that's what I was thinking when I realized I could so easily create new DB objects! It's incredibly clean, and once I realized how much I could get away with (such as the sub query stuff), I was quite pleased with the result.

Now, to eventually walk through my code base and rip out all the hard-coded stuff. Tongue[/quote]

For some reason I had it in my head that the CI database object was static and so this approach wouldn't work... :down:
#7

[eluser]monkeyhouse[/eluser]
New features are awesome.

I did have a small issue on a fresh install of CI 1.7.2 and DMZ 1.6.0.

The datamapper.php config file has this line.

Code:
$config['db_params'] = NULL;

For some reason with the line set that way I got an error that said. "You have not selected a database type to connect to."

If I set the line as follows, it fixed the problem and everything works as it did before.

Code:
$config['db_params'] = '';

Hopefully this helps anyone else that might have the same issue.
#8

[eluser]Unknown[/eluser]
monkeyhouse! thank you! i thought i was going crazy!
#9

[eluser]OverZealous[/eluser]
@monkeyhouse
Thanks for finding that. I'm not sure why it has never given me an error, but it is a definite bug (even when looking through the CI database loading source source).

I'll get a minor bugfix release put out soon.

--------------------

Update:
OK, the fix is out. I also updated the manual to reflect this change.

It turns out the DataMapper object had the correct default (''), but the config had the incorrect one (NULL). That's why I didn't see the error.

As mentioned above, if you get this error, simply change the default value of db_params to '' (empty string). It's not necessary to download the new version.
#10

[eluser]Jamie Rumbelow[/eluser]
You've done a great job with this since the beginning Phil, and with every new release it keeps getting better! It's an excellent library and I'm very, very impressed. How does DMZ handle polymorphic associations? Can you give me a quick primer on how (if) it works under the hood?

Jamie




Theme © iAndrew 2016 - Forum software by © MyBB