public function setEntity(Ajde_Model $entity) { try { $unitprice = $entity->getUnitprice(); } catch (Exception $e) { // TODO: throw new Ajde_Exception("Entity {$entity} does not have a unitprice defined"); } $this->set('entity', $entity->getTable()); $this->set('entity_id', $entity); $this->set('unitprice', $unitprice); }