예제 #1
0
파일: tax.php 프로젝트: rrsc/beansbooks
 /**
  * Returns an object of the properties for the given Model_Account (ORM)
  * @param  Model_Account $account Model_Account ORM Object
  * @return stdClass          stdClass of properties for given Model_Account.
  * @throws Exception If Model_Account object is not valid.
  */
 protected function _return_account_element($account)
 {
     $return_object = new stdClass();
     // Verify this model.
     if (!$account->loaded() or get_class($account) != "Model_Account") {
         throw new Exception("Invalid Account.");
     }
     // Account Details
     $return_object->id = $account->id;
     $return_object->name = $account->name;
     $return_object->code = $account->code;
     $return_object->reconcilable = $account->reconcilable ? TRUE : FALSE;
     $return_object->terms = (int) $account->terms;
     $return_object->balance = (double) $account->balance;
     // Account Type
     $return_object->type = $this->_return_account_type_element($account->account_type);
     return $return_object;
 }