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

[eluser]OverZealous[/eluser]
Oh, it's not a config setting. :-)

DMZ just checks to see if there is a class labeled DMZ_<name>, DataMapper_<name>, CI_<name> or <MY_><name>, where <MY_> is a config setting from within CodeIgniter (not DMZ). Otherwise it defaults to <name>.

I prefer smart code to manually configured code. It's almost always easier to use (until it conflicts with something else, of course!)

[eluser]shawn[/eluser]
OverZealous, any chance you can include something like:

Code:
// render a file upload input
    function _input_file($object, $id, $value, $options)
    {
        return $this->_render_simple_input('file', $id, $value, $options);
    }

in the htmlform extension?

[eluser]OverZealous[/eluser]
[quote author="shawn" date="1251447031"]OverZealous, any chance you can include something like [...] input_file [...] in the htmlform extension?[/quote]

Sure, I don't see why not. I modified it to look like this, though, since a file input field cannot have a default value:
Code:
// render a file upload input
    function _input_file($object, $id, $value, $options)
    {
        $a = $options + array(
            'type' => 'file',
            'name' => $id,
            'id' => $id
        );
        return $this->_render_node('input', $a);
    }

So, it's included, documented, and ready for shipping! ;-)

[eluser]mcnux[/eluser]
Thanks for the fix, Phil. Spot on now :-)

[eluser]mcnux[/eluser]
Sorry, spoke too soon! Still getting incorrect SQL on delete():
Code:
UPDATE `list_items` SET `sub_item_id` = NULL WHERE `sub_item_id` = 5

[eluser]OverZealous[/eluser]
[quote author="mcnux" date="1251466944"]Sorry, spoke too soon! Still getting incorrect SQL on delete():
Code:
UPDATE `list_items` SET `sub_item_id` = NULL WHERE `sub_item_id` = 5
[/quote]

Please give me the relationship arrays and the actual code you are writing. Thanks.

[eluser]mcnux[/eluser]
[quote author="OverZealous" date="1251467126"]Please give me the relationship arrays and the actual code you are writing. Thanks.[/quote]
Of course. I've trimmed what I actually do on a delete to as little as possible to make it clear where the issue lies. Have tested.
Code:
class List_item extends DataMapper{
  var $has_one = array(
    'list_item'=>array(
      'other_field'=>'sub_item'
    ),
  );
  var $has_many = array(
    'sub_item'=>array(
      'class'=>'list_item'
    )
  );
}

$listItem = new List_item(1);
$listItem->delete(); // standard delete; haven't overridden in List_item

// results in
UPDATE `list_items` SET `sub_item_id` = NULL WHERE `sub_item_id` = 1
Where it's obviously trying to remove the sub_item relations before it deletes the list_item.

[eluser]OverZealous[/eluser]
That SQL code is correct. What you are seeing is DMZ deleting any relationships that may occur where list_item(1) is set as the sub_item on other list_items.

[eluser]mcnux[/eluser]
So how can I get it to reference the actual FK column, which is 'list_item_id'? It does this correctly when setting up the relations?

[eluser]mcnux[/eluser]
Rubbish this is me. Completely forgot I had overridden delete() in an extension to allow for deleting after relationships are removed. Sorry my bad!!




Theme © iAndrew 2016 - Forum software by © MyBB