Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why overriding Doctrine_Record::save() give me a strict standard error in Symfony 1.2?

I have the following model :

class Model extends BaseModel
{
   public function save($conn = null)
   {
      if(!$this->getId())
      {

        //do stuff

     }
     return parent::save($conn);

    }
}

I feel like I am follwing the API description of Doctrine_Record::save() signature (Except the weird parenthesis I would give me a syntax error...).

When I run this code, it works well but I get the following warning :

Strict Standards: Declaration of Model::save() should be compatible with that of Doctrine_Record::save() in $ROOT/lib/model/doctrine/Model.class.php on line 6

I usually turn error reporting to ERROR_ALL, and try to stick with a warning free code. This bother me. I checkout all the Doctrine source code and greped "save(", on it, trying one signature after an other. Nothing. First time PHP got me for being too permissive, strange hu :-) ?

like image 520
e-satis Avatar asked Dec 06 '22 06:12

e-satis


1 Answers

The correct signature for the save method should be:

public function save(Doctrine_Connection $conn = null)
like image 189
bb. Avatar answered Mar 17 '23 05:03

bb.