Why does overriding Doctrine_Record :: save () give 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); } } 

It seems to me that I am describing the API description signature Doctrine_Record :: save () (except for the strange parentheses I would give me a syntax error ...).

When I run this code, it works fine , 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 send an error message to ERROR_ALL and try to adhere to the warning code. It bothers me. I check all the Doctrine source code and greped "save (" on it, I try one signature after another. Nothing. The first time PHP made me be too permissive, weird hu :-)?

+4
source share
2 answers

The correct signature for the save method should be:

 public function save(Doctrine_Connection $conn = null) 
+16
source

On the side of the note: for other functions, you may get this error, but instead you will need to use the ($ event) function.

0
source

Source: https://habr.com/ru/post/1285647/


All Articles