Hi, I have a model where I'm trying to access the 'id' field. For example, I have the following code:
PHP Code:
<?php
class Animal extends Zend_Db_Table {
protected $_name = 'animals';
public function previousAnimal() {
$animal = new Animal();
$where = $animal->getAdapter()->quoteInto( 'id > ?', $this->id ); // Error on: $this->id
$orderBy = 'id DESC';
$previousAnimal = $animal->fetchAll( $where, $orderBy, 1 );
return $previousAnimal;
}
public function nextAnimal() {
$animal = new Animal();
$where = $animal->getAdapter()->quoteInto( 'id < ?', $this->id ); // Error on: $this->id
$orderBy = 'id ASC';
$nextAnimal = $animal->fetchAll( $where, $orderBy, 1 );
return $nextAnimal;
}
}
?>
At this time, I'm getting the following message:
Undefined property Animal::$id
How does one define the properties of a model?
Thanks in advance,
-Conrad