I have created a Zend Framework model by extending Zend_Db_Table_Absract as follows (simplified example):
class Foos extends Zend_Db_Table_Abstract
{
    protected $_schema = 'Foo';
    protected $_name = 'Foos';
    protected $_primary = 'id';
    protected $_sequence = true;
    public function insert($data) {
        $db = $this->getAdapter();
        $record = array('field1' => $data['field1'],
                        'field2' => $data['field2'],
                        ...
                );
        return parent::insert($record);
    }
}
The above correctly inserts a record. The problem is, I keep getting the following notice:
Strict Standards: Declaration of Foos::insert() should be compatible with that of Zend_Db_Table_Abstract::insert() in /x/x/x/Foo.php on line XX
As far as I can tell from having read the documentation and API several times, the way I am doing it is correct. I am aware that I can turn off E_STRICT but I would much rather know why I am getting the above notice. Any ideas? (PHP 5.3, Zend Framework 1.10)
Mchl is mostly correct but the error you're getting is from the parameter not matching exactly i.e.:
public function insert($data) {
should be:
public function insert(array $data) {
note the array type specifier before $data, the mixed you're seeing is the return type, the argument type is array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With