public function savePage(Page $page) { $data = $page->getArrayCopy(); if (!$data['id']) { $this->insert($data); } else { $this->update($data, array("id" => $data['id'])); } }
public function testGetArrayCopyReturnsAnArrayWithPropertyValues() { $album = new Page(); $data = array('article' => 'some artist', 'id' => 123, 'title' => 'some title'); $album->exchangeArray($data); $copyArray = $album->getArrayCopy(); $this->assertSame($data['article'], $copyArray['article'], '"artist" was not set correctly'); $this->assertSame($data['id'], $copyArray['id'], '"id" was not set correctly'); $this->assertSame($data['title'], $copyArray['title'], '"title" was not set correctly'); }