public function testConstruction() { $data = ['name' => 'Rob Allen', 'biography' => 'Lorem ipsum dolor sit amet']; $author = new Author($data); $this->assertEmpty($author->getId()); $this->assertSame($data['name'], $author->getName()); $this->assertSame($data['biography'], $author->getBiography()); }
/** * Update a record in the database * * @param Author $author * @return boolean */ protected function update(Author $author) { $sql = 'UPDATE author SET name =:name, biography = :biography WHERE id = :id'; $params = ['name' => $author->getName(), 'biography' => $author->getBiography(), 'id' => $author->getId()]; $statement = $this->dbAdapter->prepare($sql); return $statement->execute($params); }