Welcome Guest, Not a member yet? Register   Sign In
DMZ 1.7.1 (DataMapper OverZealous Edition)

[eluser]MelloMike[/eluser]
Hi matyhaty! Thanks for the quick reply.. I had to change get() to get_iterated() and it worked... only problem is that it's just returning all the images but not actually associating them with the correct model.

so I can't use something like this after I use that code..
Code:
foreach($u as $user)
{
    echo $user->profile-image->all_to_array();
}

The above will return ALL the images for every profile inside of the first $user->profile->all_to_array(); ... the rest will be empty.

[eluser]anaxamaxan[/eluser]
@MelloMike I made that mistake with include_related too, but include_related and deep relationships only work along one-to-one relationships. You'll need to call get() on each Profile instance to access the related images.

[eluser]MelloMike[/eluser]
[quote author="anaxamaxan" date="1293413183"]@MelloMike I made that mistake with include_related too, but include_related and deep relationships only work along one-to-one relationships. You'll need to call get() on each Profile instance to access the related images.[/quote]

Awwww, thats a bummer.. but thanks. At least I know what I have to do now.

[eluser]WanWizard[/eluser]
Having include_related() work on has_many is on the todo list, but it won't be in time for the next release (due in the next couple of days).

[eluser]Haqqi[/eluser]
Update: Sorry, my fault. I should use update() method instead of save().

I downloaded latest source of DataMapper from Bitbucket.

What I want to ask is how to ignore created and updated field? Because not all my tables have created and updated fields. If i just try to write:

Code:
$opt = new Option();
$opt->get_by_key('the_key');
$opt->value = 'new_value';
$opt->save();

I got an error that DataMapper try to update "updated" field. I have changed the config item "updated_field" to "null", but it seems that DataMapper use default "updated" as the name of the field.

[eluser]WanWizard[/eluser]
Should work with save() as well.

I've found the problem, I'll update it on bitbucket later today.

[eluser]Guido Mallee[/eluser]
Hi,

I'm new to DMZ but finding some trouble combining DMZ with the structure I use to mantain in my databases.

That's because I add an 'active' field to every table in my DB. When I want to delete a record from a table, I never really delete it, but set the active field of that record to FALSE.

I know this method has it's advantages and disadvantages, but so far I've never regret that I started using this consequently.

Of course it's possible to keep using this method in DMZ, though i would like this to be applied by default on methods like get() and delete().

Will I have to write my own extension or will I be reinventing the wheel?

Many thanks!

[eluser]WanWizard[/eluser]
Datamapper is just a class, and as such, it can be extended.

Overload the get() and delete() methods to deal with your active field. For get(), you could just include a where clause including 'active', delete should require more attention as it deals with deleting relationships as well.

[eluser]Guido Mallee[/eluser]
Thanks! I'll dig in to that then..

[eluser]Guido Mallee[/eluser]
Something else:

I'm busy porting one of my CI projects to work with DataMapper. Seemed to be going fine untill i got this php error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 40961 bytes) in C:\xampp\htdocs\spzw\system\core\Loader.php on line 665

Also when I output my $data variable, that I pass to my view, with FirePHP, it seems to be huge (lot's of data I do not use)! And of course, the page loads very slow (ending up with the above error).

Is there a commonly made mistake that could cause DataMapper use so much memory?

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB