Part of the EllisLab Network
   
2 of 20
2
[Deprecated] DMZ 1.5.4 (DataMapper OverZealous Edition)
Posted: 21 October 2009 08:25 AM   [ Ignore ]   [ # 11 ]  
Grad Student
Rank
Total Posts:  47
Joined  02-13-2009

Yep, typo wink

I had a look @ Doctrine, and there are surely reasons to choose it over DMZ… But I don’t know, I feel like DMZ’s more CI-compliant (built by CI users, so its CI-minded, and respects the CI conventions—for instance, the use of underscores is something I require from an external library). But maybe my arguments just make me look stupid over the forums.

I’ll be trying your code then! I’m excited because it is actually much more simpler than I thought! Thanks man smile

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

It’s quite easy, but if you have concrete questions not like “How can I create a model” there is nobody to answer your questions. And in a commercial environment this is too difficult to work with.

If you need an answer which is not covered or at least not clearly explained/mentioned in the docs how you want to find out?

But if you ask how it works the reply is “Read the docs”. Yeah, and this is not the way to support users in a community, hm?

Anyway, good luck with DM smile

 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 09:42 AM   [ Ignore ]   [ # 13 ]  
Grad Student
Rank
Total Posts:  47
Joined  02-13-2009

I think DMZ is a pretty advanced and powerful tool. Indeed, if the support isn’t enough, that’s a big concern… On my side, I’ll stick with it, and try to get used to it. Doctrine is a great candidate, which surely has more support & docs, though I think I’ll learn DMZ faster than Doctrine because I’m used of the CI way of doing things, you know? But hey, YOU’ve been of great support, right? wink

Profile
 
 
Posted: 21 October 2009 09:49 AM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  804
Joined  06-10-2009
Benedikt - 21 October 2009 12:55 PM

It’s quite easy, but if you have concrete questions not like “How can I create a model” there is nobody to answer your questions. And in a commercial environment this is too difficult to work with.

If you need an answer which is not covered or at least not clearly explained/mentioned in the docs how you want to find out?

But if you ask how it works the reply is “Read the docs”. Yeah, and this is not the way to support users in a community, hm?

Anyway, good luck with DM smile

I’m sure OverZealous would be happy to work out a consulting relationship to provide paid support for those who prefer not to read manuals. If he isn’t, I would :D

 Signature 

CreativeHalls Web Design and Printing
A few of my projects:
OurGulfCoast Property Management and Vacation Rental (ASP/.NET)
BukuBux - Money Saving Coupons and Gift Certificates (CodeIgniter, LAMP/MySQL)
Rentals800.com - Find a place to rent (CodeIgniter, LAMP/MySQL)
bdh (dot) hall (at) gmail (dotcom)

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

If the manual would cover the question, then sure a paid consulting is reasonable.

And btw, I dont mind paying for support. I even donate for OSS :-O

 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 10:08 AM   [ Ignore ]   [ # 16 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  804
Joined  06-10-2009

OK, now a real question. I’m looking to see if there is a short-hand for what I’m doing.

On a few forms and displays where I have lots of data entry and multiple relationship options to display. So I might have a Listing that needs drop-down boxes populated with propertytype, garagetype, amenities, petpolicy, etc etc. Right now to prep everything I do this:

$listing->propertype->get();
$listing->garagetype->get();
$listing->amenities->get();
$listing->petpolicy->get();
///...etc, etc 

It isn’t a big deal, but is there a simple way to do this - like a load_all_related() function or somesuch so I don’t have to load up each one individually?

I know about autoload/autopopulate features, but this is limited to just needing to use it in a few places. Its purely an attempt to reduce a few lines of code, but DMZ has so much flashy coolness that I figured I might be very well missing something.

 Signature 

CreativeHalls Web Design and Printing
A few of my projects:
OurGulfCoast Property Management and Vacation Rental (ASP/.NET)
BukuBux - Money Saving Coupons and Gift Certificates (CodeIgniter, LAMP/MySQL)
Rentals800.com - Find a place to rent (CodeIgniter, LAMP/MySQL)
bdh (dot) hall (at) gmail (dotcom)

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

I didnt test it yet, but you could try to use a loop maybe?

I think it should work to say sth like this:

$objects = array( "propertype""garagetype""amenities""petpolicy" );

foreach ( 
$objects as $relation {
   $listing
->$relation->get();

Maybe you can try this and it works or you can take it at least as a hint for further creativity.

Btw, Im sure this is also covered in some manual somewhere :-p Just kidding.

 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 11:30 AM   [ Ignore ]   [ # 18 ]  
Summer Student
Total Posts:  1
Joined  10-21-2009

Hi there,
i am pretty new to DMZ, however I have some problems I was not able to solve by reading the (good) documentation:

1. creating more complex queries with count:
example: I have a users table and a user_group table(each user belongs to 1 group). I want to show a list of all groups and the appropriate number of users belonging to this group.
I want to use only 1 query (performance reasons: I have thousands of groups)
in SQL this is simple:

SELECT ug.* , count( u.id ) as count
FROM user_groups` ug
LEFT JOIN users u ON ug.id = u.group_id
WHERE mg.user_id = ?
GROUP BY mg.id

How can I do this in DMZ?


2. Delete relation, avoid setting id to NULL
example:
User table and media table with 1:n relation (1 user has many media) by user.id = media.user_id
If I delete a user(eg id=2), all media.user_id will be set to NULL which were 2 before. In SQL:

UPDATE `media` SET `user_id` = NULL WHERE `user_id` = ‘2’

However I want to completely remove them like this:
DELETE FROM media WHERE `user_id` = ‘2’


3. Unnecessary SELECT statements:
Before the Query from 2 there is always a

SELECT * FROM `media` LIMIT 1

What purpose is this? Can I switch this off?


Best regards,
Peter

Profile
 
 
Posted: 21 October 2009 12:23 PM   [ Ignore ]   [ # 19 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  117
Joined  11-13-2008

@peterparker2k

3. Unnecessary SELECT statements:
Before the Query from 2 there is always a

SELECT * FROM `media` LIMIT 1

What purpose is this? Can I switch this off?

Useless for the application (unless CACHED).  However, in the realm of an ORM, it is ever so necessary for Datamapper and DMz (it’s derivative).

The first time a model is used on a requestDataMapper connects to the database server and loads in the columns for its tableThis can create a few extra queries per pageDMZ also does a fair amount of set up on each class, determining things like relationship fieldstweaking the validation rules, and moreAll of this can be cached to a filewhich is included directly as PHP code
Profile
 
 
Posted: 21 October 2009 03:46 PM   [ Ignore ]   [ # 20 ]  
Grad Student
Rank
Total Posts:  47
Joined  02-13-2009

EDITED: Found the answer in the docs!

Profile
 
 
   
2 of 20
2