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

[eluser]ennis[/eluser]
Thanks "rtfm" I know Smile too tempting to post on here sorry.

Will go figure it out Smile

[eluser]ennis[/eluser]
woop all done thanks Smile

[eluser]Vlad0[/eluser]
This is first ORM that I ever used... and its great.. I was satisfied with AR till now.

But I have one question. I dont know is it in every ORM but when I wont to get listing of some records eg.

$users = new User();
$users->limit(5)->get();
foreach ($users->all as $user){
print_r($user);
}

$user object return to much informations and it is to big. Can I limit it on just db fields or just get what I wont?

[eluser]OverZealous[/eluser]
@Vlad0
From the manual:
Why can't I use print_r, var_dump, or json_encode on a DataMapper model?

[eluser]Vlad0[/eluser]
RTFM Smile thanks for fast answer Smile

So its not waste of memory Smile

[eluser]OverZealous[/eluser]
[quote author="Vlad0" date="1255706209"]So its not waste of memory Smile[/quote]

Well, it's not a waste of memory because DMZ wouldn't work without it ;-)

The majority of information you see in a DMZ object is shared across all instances (for example, $fields and the $validation array). The only information that isn't shared is object-specific information.

RAM usage can be high with very large datasets (over 5000 rows). I have had plenty of discussions in the past on how I feel about having large amounts of data in memory, so I won't revisit it all again, but if you need large datasets for some reason, I recommend a hybrid approach, where you use DMZ to build the query, but then get it and process it manually using the native AR methods.

For example:
Code:
$object = new DMZObject();
$object->where(...)->where_related(...); // etc

$results = $object->db->get($limit, $start);
//   Notice this -- ^^^^

// $results is now a CodeIgniter ActiveRecord result set, so
// you can use the CI method for looking at the data.
// No new DMZ objects have been instantiated.

The only limitation to the hybrid is that you cannot use the DataMapper method for related objects (meaning, $object1->$object2)

Edit: Wow, that is one heck of a run-on sentence up there... Smile

[eluser]Muser[/eluser]
Hi, I am using DMZ version 1.4.0


I have a strange behaviour when I use the htmlform extension and I try to submit a radio group.

When the validation fails, the property checked for all the inputs of type radio becomes to checked="checked".

I have updated codeigniter from 1.7.1 from 1.7.2 and I still get the same issue.

[eluser]Muser[/eluser]
I have updated to 1.4.3 and I still have the same problem Sad

[eluser]monkeyhouse[/eluser]
I'm having issues saving a relationship. DMZ is generating a database error:

Code:
SELECT COUNT(*) AS `numrows` FROM (`servicecategories_serviceproviders`) WHERE ( `servicecategories`.`id` NOT IN (1) ) AND `serviceprovider_id` = 1

I have three tables set up like this.

Code:
servicecategories
-id
-title
-description

serviceproviders
-id
-name
-address

servicecategories_serviceproviders
-id
-servicecategory_id
-serviceprovider_id

I've defined the $has_many in both models, I'm using the htmlform extension to generate the form and it generates the options correctly.

The portion of my controller that saves looks like this:
Code:
if (!empty($_POST)) {
            
    $data->provider->from_array($_POST);
                        
    $sc = new Servicecategory();
    $sc->where_in('id', $this->input->post('servicecategory'))->get();
                        
        
    if ($data->provider->save($sc)) {
    redirect('admin/services/providers');            
    }
}

I can't figure out what I'm doing wrong. If I change the SQL query to the following I get a result.

Code:
SELECT COUNT(*) AS `numrows` FROM (`servicecategories_serviceproviders`), `servicecategories` WHERE ( `servicecategories`.`id` NOT IN (1) ) AND `serviceprovider_id` = 1

Is this a DMZ issue or something I did wrong?

[eluser]OverZealous[/eluser]
[quote author="monkeyhouse" date="1256082415"]Is this a DMZ issue or something I did wrong?[/quote]

A few things, for future reference:
1) When posting errors, it helps if you post the error itself. That way we don't have to figure out what's wrong.

2) It helps to have the relevant portions of the model, such as parts of validation array.

That being said, I'm pretty sure you are using related validation rules, and it does appear to be a bug in DMZ in how it generates the related query.

I don't have the time to fix it and package it properly right now, but I threw together a possible fix. I've attached an updated version of the datamapper.php library that should fix this bug. Please test it out, and let me know.




Theme © iAndrew 2016 - Forum software by © MyBB