/** * Retrieves the specified property lease. * * @param integer $propertyLeaseId * The unique property lease identifier. * * @return mixed * The property lease details, encapsulated in a Model_Referencing_PropertyLease * object, or null if the property lease cannot be found. */ public function getByPropertyLeaseId($propertyLeaseId) { $select = $this->select(); $select->where('id = ?', $propertyLeaseId); $propertyLeaseRow = $this->fetchRow($select); if (empty($propertyLeaseRow)) { Application_Core_Logger::log(get_class() . '::' . __FUNCTION__ . ':Unable to find property lease.'); $returnVal = null; } else { $propertyLease = new Model_Referencing_PropertyLease(); $propertyLease->id = $propertyLeaseRow->id; //Add the address details if (!empty($propertyLeaseRow->address_id)) { $addressDatasource = new Datasource_Core_Addresses(); $propertyLease->address = $addressDatasource->getById($propertyLeaseRow->address_id); } if ($propertyLeaseRow->monthly_rent >= 0) { $propertyLease->rentPerMonth = new Zend_Currency(array('value' => $propertyLeaseRow->monthly_rent, 'precision' => 0)); } if (!empty($propertyLeaseRow->start_date)) { if ($propertyLeaseRow->start_date != '0000-00-00') { $propertyLease->tenancyStartDate = new Zend_Date($propertyLeaseRow->start_date, Zend_Date::ISO_8601); } } $propertyLease->tenancyTerm = $propertyLeaseRow->term; $propertyLease->noOfTenants = $propertyLeaseRow->no_of_tenants; $returnVal = $propertyLease; } return $returnVal; }
/** * Retrieves the OccupationalReferee for a specific Occupation. * * @param integer $occupationId * The unique Occupation identifier. * * @return mixed * Returns a Model_Referencing_OccupationalReferee object, or null if no * referee is found. */ public function getByOccupationId($occupationId) { if (empty($occupationId)) { return null; } $select = $this->select(); $select->where('occupation_id = ?', $occupationId); $refereeRow = $this->fetchRow($select); if (empty($refereeRow)) { $returnVal = null; } else { $occupationalReferee = new Model_Referencing_OccupationReferee(); $occupationalReferee->occupationId = $refereeRow->occupation_id; if (!empty($refereeRow->name_id)) { $namesDatasource = new Datasource_Core_Names(); $occupationalReferee->name = $namesDatasource->getById($refereeRow->name_id); } if (!empty($refereeRow->contact_id)) { $contactDatasource = new Datasource_Core_ContactDetails(); $occupationalReferee->contactDetails = $contactDatasource->getById($refereeRow->contact_id); } if (!empty($refereeRow->address_id)) { $addressDatasource = new Datasource_Core_Addresses(); $occupationalReferee->address = $addressDatasource->getById($refereeRow->address_id); } $occupationalReferee->organisationName = $refereeRow->organisation_name; $occupationalReferee->position = $refereeRow->referee_position; $returnVal = $occupationalReferee; } return $returnVal; }
/** * Retrieves the ResidentialReferee for a specific Residence. * * @param integer $residenceId * The unique Residence identifier. * * @return mixed * Returns a Model_Referencing_ResidentialReferee object, or null if no * referee is found. */ public function getByResidenceId($residenceId) { if (empty($residenceId)) { return null; } $select = $this->select(); $select->where('residence_id = ?', $residenceId); $refereeRow = $this->fetchRow($select); if (empty($refereeRow)) { $returnVal = null; } else { $residentialReferee = new Model_Referencing_ResidenceReferee(); $residentialReferee->residenceId = $refereeRow->residence_id; $residentialReferee->type = $refereeRow->type_id; if (!empty($refereeRow->name_id)) { $namesDatasource = new Datasource_Core_Names(); $residentialReferee->name = $namesDatasource->getById($refereeRow->name_id); } if (!empty($refereeRow->contact_id)) { $contactDatasource = new Datasource_Core_ContactDetails(); $residentialReferee->contactDetails = $contactDatasource->getById($refereeRow->contact_id); } if (!empty($refereeRow->address_id)) { $addressDatasource = new Datasource_Core_Addresses(); $residentialReferee->address = $addressDatasource->getById($refereeRow->address_id); } $returnVal = $residentialReferee; } return $returnVal; }