I am reading Survive the deep end. There I read the following section:
$this->_mapper->save($entry);
$this->assertEquals(123, $entry->id);
Code for mapper::save is as follows:
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
As you can see the variable is not passed by reference, then how the value will get changed in $entry in the calling function ? (i.e; $this->_mapper->save($entry); $this->assertEquals(123, $entry->id);)
Objects are always passed by reference.