/**
  * Get image users
  *
  * @param string $sImageId
  * @return \PluginLsgallery_ModuleImage_EntityImageUser
  */
 public function GetImageUsersByImageId($sImageId)
 {
     $sql = "\n                SELECT\n                    *\n                FROM\n                    " . Config::Get('db.table.lsgallery.image_user') . "\n                WHERE\n                    image_id = ?d\n            ";
     $aResult = array();
     if ($aRows = $this->oDb->select($sql, $sImageId)) {
         foreach ($aRows as $aRow) {
             $aResult[] = Engine::GetEntity('PluginLsgallery_ModuleImage_EntityImageUser', $aRow);
         }
     }
     return $aResult;
 }
 protected function _authenticate()
 {
     try {
         $resultIdentities = $this->_db->select($this->_sql, $this->_credential, $this->_identity);
     } catch (Exception $e) {
         /**
          * @see Zend_Auth_Adapter_Exception
          */
         require_once 'Zend/Auth/Adapter/Exception.php';
         $exception = 'The supplied parameters to ' . __CLASS__ . 'failed to produce a valid sql statement, please ' . 'check table and column names for validity.';
         throw new Zend_Auth_Adapter_Exception($exception);
     }
     return $resultIdentities;
 }
 /**
  * Загружает зависимости $subItemName для данной сущности
  * @param $subItemName
  * return bool
  */
 function loadRelated($subItemName, $fk = null)
 {
     if (method_exists($this, "load{$subItemName}")) {
         return call_user_func(array($this, "load{$subItemName}"));
     } else {
         $tableName = Lms_Item::getTableName($subItemName);
         if ($fk === null) {
             $fk = $this->_getSimplePk();
         }
         $fkValue = $this->__getValue($fk);
         $rows = $this->_slaveDb->select("SELECT * FROM {$tableName} WHERE ?#=?", $fk, $fkValue);
         if ($rows) {
             $subItemPk = Lms_Item::getStruct($subItemName)->getPk();
             foreach ($rows as $row) {
                 $scalarPkValue = Lms_Item_Scalar::extractScalarPkValue($row, $subItemPk);
                 Lms_Item_Store::setValues($tableName, $scalarPkValue, $row, true);
             }
             Lms_Item_Store::rebuildIndex($tableName);
         }
     }
 }
 /**
  * This method accepts a Zend_Db_Select object and
  * performs a query against the database with that object.
  *
  * @param Zend_Db_Select $dbSelect
  * @return array
  */
 protected function _authenticateQuerySelect($dbSelect)
 {
     $resultIdentities = $this->_db->select($dbSelect, $this->_credential, $this->_identity);
     return $resultIdentities;
 }