我正在阅读在深渊中求生。在那里我阅读了以下部分:
$this->_mapper->save($entry);
$this->assertEquals(123, $entry->id);
mapper::save 的代码如下:
public function save(ZFExt_Model_Entry $entry) {
if(!$entry->id) {
$data = array(
'title' => $entry->title,
'content' => $entry->content,
'published_date' => $entry->published_date,
'author_id' => $entry->author->id
);
$entry->id = $this->_getGateway()->insert($data);
....contd
如您所见,变量不是通过引用传递的,那么调用函数中 $entry 中的值将如何更改?(即; $this->_mapper->save($entry); $this->assertEquals(123, $entry->id);)