예제 #1
0
 /**
  * Find admin
  *
  * @param int $applicationId
  * @param string $username
  * @param Admin_Model_Admin $admin
  * @return boolean
  */
 public function find($applicationId, $username, Admin_Model_Admin $admin)
 {
     $select = $this->_dbTable->select();
     $select->setIntegrityCheck(false)->from(array('a' => 'admin'), array('a.*'))->joinLeft(array("aa" => "admin_application"), "aa.admin_id = a.id")->where('a.username = ?', $username)->where('aa.application_id = ?', $applicationId);
     $resultSet = $this->_dbTable->fetchAll($select);
     if (0 == count($resultSet)) {
         return false;
     }
     //get first row from resultSet
     $row = $resultSet->current();
     $admin->setOptions($row->toArray());
     return true;
 }