public function testConstructorInjectionOfProperties() { $data = array('username' => 'joe_bloggs', 'fullname' => 'Joe Bloggs', 'email' => '*****@*****.**', 'url' => 'http://www.example.com'); $author = new ZFExt_Model_Author($data); $expected = $data; $expected['id'] = null; $this->assertEquals($expected, $author->toArray()); }
public function save(ZFExt_Model_Author $author) { $data = $author->toArray(); if (!$author->id) { $author->id = $this->_getGateway()->insert($data); $this->_setIdentity($author->id, $author); } else { $where = $this->_getGateway()->getAdapter()->quoteInto("id = ?", $author->id); $this->_getGateway()->update($data, $where); } }