예제 #1
0
 /**
  * @throws DataBackendException
  * @return Agency[]
  * @see DataBackend::getAgenciesForBank()
  */
 public function getAgenciesForBank(Bank $bank)
 {
     try {
         $stmt = $this->statementContainer->prepare("SELECT {$this->agencyAttributes} FROM {$this->prefix}agency a\n                    WHERE bank = :bankID AND id != :mainAgency");
         $agencies = array();
         $stmt->execute(array(":bankID" => $bank->getBankID(), ":mainAgency" => $bank->getMainAgency()->getID()));
         foreach ($stmt->fetchAll() as $agencyResult) {
             $agencies[] = $this->getAgencyObject($bank, $agencyResult);
         }
         $stmt->closeCursor();
         return $agencies;
     } catch (\PDOException $e) {
         $stmt->closeCursor();
         throw new DataBackendIOException($e->getMessage(), 0, $e);
     } catch (MissingAttributesDataBackendIOException $e) {
         $stmt->closeCursor();
         throw new \LogicException($e);
     }
 }
예제 #2
0
파일: Agency.php 프로젝트: bmdevel/bav
 /**
  * @return bool
  */
 public function isMainAgency()
 {
     return $this->bank->getMainAgency() === $this;
 }