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

[eluser]OverZealous[/eluser]
You have it backwards. ;-)

Each publication has many images, so put 'image' into the $has_many array for Publication. Each image has one publication, so put 'publication' into the $has_one array for Image.

Your 'images' table should have the column 'publication_id'. Then DMZ should figure out everything else for you.

Good Luck! :-)

[eluser]Atas[/eluser]
Thank you very much for your time, works ok !

[eluser]introvert[/eluser]
Hello.

I want to update "updated" field when I update the relationship objects.
DM OZ seems not to do that, although I set updated to "" (updated = "") and call save(); function.

What should I do?

Thanks for help!

[eluser]Wible[/eluser]
I'm a recent DMZ convert (from Datamapper). I've gone through your code and what you offer and I have to say I can't wait to really get into it.

That said, I'm working on a major project and I'm building it from the ground up. I would like your advice if you have a minute... is there any authentication/user library/extension that you recommend for integrating with DMZ?

I've reviewed several (probably a dozen or more) libraries and found MAYBE one or two that I felt had good, clean code, blah blah blah. BUT - none of them leverages what you offer with DMZ.

I could write my own, and I'm a hair into that already, but I'm a strong believer in not reinventing the wheel. But cleaning up someone else's junk just to make it work with DMZ isn't my idea of a good time.

Do you have any recommendations? My "inner Yoda" is telling me to write my own and offer it to the community but I have a feeling someone else already has - or maybe you have one?

All that aside - thank you for doing what you do. There's a page slotted in my "master plan" to credit my contributors with a cozy spot for you when this is all done. Doesn't count for much, but I'll be making a donation when the time comes too Smile

Your code rocks and helps my code rock. Thanks!

[eluser]OverZealous[/eluser]
[quote author="introvert" date="1273460282"]I want to update "updated" field when I update the relationship objects.
DM OZ seems not to do that, although I set updated to "" (updated = "") and call save(); function.[/quote]

As you noted, updated only changes when the object itself has changed. There's no supported way to change this behavior.

One possible way, though, is to create an extra database column (like an int), and then override the save() function to increment this column whenever save() is called with an object.

Or maybe someone has a better idea. Smile

[eluser]OverZealous[/eluser]
[quote author="Wible" date="1273467332"]I'm working on a major project and I'm building it from the ground up. I would like your advice if you have a minute... is there any authentication/user library/extension that you recommend for integrating with DMZ?[/quote]

Thank you for your positive feedback! It's very encouraging. Smile

I don't have an authentication library I use. My application required fairly integrated auth functionality, so I rolled my own. I based it on the original code from stensi that is still provided as an example in DMZ. The example app uses the same basic mechanism for authorization.

I don't think anyone has yet created a dedicated extension to DMZ for authorization, so if you wanted to roll a generic one, that would be very appreciated. :-)

[eluser]Wible[/eluser]
Maybe I'll make that part of my mission. No reason why I can't code it generic enough for others to use. I may contact you when/if I finish it. Anyway, I'm so psyched to see you're an active participant in the community - the first two libraries I used were practically abandoned!

Anyway... I think I'm going to take this on. I may approach you for feedback or advice if I run into snags.

[eluser]jparent[/eluser]
Hi, I don't know if this question is solved, but I can't find the answere anywhere. When I use datamapper object in my apps and I want to show a query as a table I can't do somethink like:

$data = $dtmpper_obj->get()->all;
show_data_as_table($data);

I can't do that because in the table appears not only the data that I obtain in the select. Appears other fields of DataMapper main object, like prefixes, relationships,...

any solutions? Thanks!

[eluser]Alface[/eluser]
[quote author="jparent" date="1273495663"]Hi, I don't know if this question is solved, but I can't find the answere anywhere. When I use datamapper object in my apps and I want to show a query as a table I can't do somethink like:

$data = $dtmpper_obj->get()->all;
show_data_as_table($data);

I can't do that because in the table appears not only the data that I obtain in the select. Appears other fields of DataMapper main object, like prefixes, relationships,...

any solutions? Thanks![/quote]

You have 3 way to solve it..

Transfer the values to array before:
Code:
$array = array();
$dtmpper_obj->get();
foreach($dtmpper_obj->all as $value){
    $data[] = $value;
}
show_data_as_table($data);

Sending your DMZ objet to your helper(function) and execute the same foreach there:
Code:
$dtmpper_obj->get();
show_data_as_table($dtmpper);


Or you can create a method on your DMZ class and call it like this (best way for me):
Code:
$dtmpper_obj->get();
$dtmpper_obj->show_data_as_table();

[eluser]introvert[/eluser]
[quote author="OverZealous" date="1273467760"][quote author="introvert" date="1273460282"]I want to update "updated" field when I update the relationship objects.
DM OZ seems not to do that, although I set updated to "" (updated = "") and call save(); function.[/quote]

As you noted, updated only changes when the object itself has changed. There's no supported way to change this behavior.

One possible way, though, is to create an extra database column (like an int), and then override the save() function to increment this column whenever save() is called with an object.

Or maybe someone has a better idea. Smile[/quote]

Can you include function update_timestamps in next version?

Would be cool so that we can use custom call as well.




Theme © iAndrew 2016 - Forum software by © MyBB