0
votes

I found that when i call

Hierarchy::addFirstNodeBelowOfId(1);

in controller just once. The result is that the model call stored routine named

hierarchy_addFirstNodeBelowOfId();

twice.

class Hierarchy extends Model{
.
.
.
public static function addFirstNodeBelowOfId($nodeId, $newNodeName = 'new node'){
    $sql = "call `hierarchy_addFirstNodeBelowOfId`($nodeId, '$newNodeName');";
    $model = new Hierarchy();
    $results = new Resultset(null, $model, $model->getWriteConnection()->query($sql)); 
    return $results;
}
}

Does anyone know why Model do like that? or I did something wrong. please suggest.

1
Try without last line return $results; or make it like return $results = new Resultset(null, $model, $model->getWriteConnection()->query($sql));. - Tpojka
Tried. the result is the same... twice. - Apiwat Jarruwattanachai
Also tried ->execute($sql)); instead of ->query($sql)); but the result is the same. - twice... - Apiwat Jarruwattanachai
Also tried just $model->getWriteConnection()->execute($sql); instead of new Resultset(...); but the result is the same. - twice - Apiwat Jarruwattanachai
Is there something in constructor maybe? - Tpojka

1 Answers

0
votes

Finally, I found that there are extra request to /favicon.ico where favicon.ico does not exist then it redirect to my default homepage so it seem that i request to my default homepage twice.

[Tue, 22 Sep 15 11:11:41 +0700][DEBUG] $_SERVER['REQUEST_URI'] : /
[Tue, 22 Sep 15 11:11:41 +0700][DEBUG] $_SERVER['REQUEST_URI'] : /favicon.ico

Solved by add favicon.ico into /public/ folder.