Ejemplo n.º 1
0
 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());
 }
Ejemplo n.º 2
0
 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);
     }
 }