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

[eluser]Alface[/eluser]
[quote author="OverZealous" date="1270798148"]@Alface
The HTMLForm extension is no longer supported or being updated.

Feel free to modify the extension directly.[/quote]

O.O

But but but.. it is so important O.O

anyway, just to know, how could I modify the extension without doing it directly?

[eluser]rideearthtom[/eluser]
Quick question - should I be setting up cascade rules for deleting records in join tables in my database? Or is that going to make DMZ throw a wobbly when it does its automatic relation deleting routines? Should I set NULL on cascade instead?

[eluser]jpi[/eluser]
Short answer : the second option. (with NULL column)

[eluser]OverZealous[/eluser]
@rideearthtom
For in-table foreign keys, use NULL, but for join tables, you can safely use cascade rules if you prefer. However, they will most likely never run, since DMZ manually deletes all relationships first before deleting an item.

[eluser]rideearthtom[/eluser]
Thanks!

[eluser]tomdelonge[/eluser]
Join fields are confusing me. I have a many to many relationship. In the view file, I have a foreach loop that should include the join column. I know I need to use the "include_join_fields()" method and "get()" method both within the foreach loop so it does it each time. However, the way I have it now it just gets the same value every time.

This is in my foreach loop:
Code:
foreach($ys->all as $y)
{
$x->y->include_join_fields()->get();
$value = $x->y->join_value;

echo $value;
}

Basically, I can see why it's the same value every time. I just need to narrow my query to say "when x is related to the current $y in the loop (not just the Y model)".

Any ideas? I'm sure I'm just missing something simple...

[eluser]bEz[/eluser]
nvm

[eluser]TheJim[/eluser]
[quote author="tomdelonge" date="1271275512"]
This is in my foreach loop:
Code:
foreach($ys->all as $y)
{
$x->y->include_join_fields()->get();
$value = $x->y->join_value;

echo $value;
}
[/quote]

I don't have a lot of time to try to set up something similar and make sure I know exactly what you're getting at, but what is clear is that you're not using $y, which is of course the changing value.

So, I would think that at least you'd want

Code:
foreach($ys->all as $y)
{
$y->x->include_join_fields()->get();
$value = $y->x->join_value;

echo $value;
}

That is, switching the y and the x (assuming x is also your model name and not just a variable name).

And of course I don't really know what you're doing, but in all likelihood you could set up your query such that you don't have to do another get() in the loop. That's a separate issue though.

[eluser]tomdelonge[/eluser]
I figured it out. Many to Many with join fields was confusing me, but I should have been doing the query on the opposite model (Thanks to TheJim).

[eluser]bEz[/eluser]
Glad you resolved it, I was bothered with work here when I was going to try and assist you. Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB