Example #1
0
 public function getStorage($tableName)
 {
     return modelStorage::create($this, $tableName);
 }
Example #2
0
 protected function _constructJoins($sourceTable = null)
 {
     if ($sourceTable === null) {
         $this->getStorage()->registerForeignKeys();
         $this->_join = array();
         // reset joins
         $sourceTable = $this->_storageSource;
         $this->_alreadyJoined = array();
     }
     $rootId = $this->_storageSource->getUniqueId();
     $sourceId = $sourceTable->getUniqueId();
     $this->_alreadyJoined[$sourceId] = true;
     //$allJoins = array(); // [target][source] = joinId
     //$joinContent = array();
     //$joinId = 0;
     // JOIN WITH
     if (isset($this->_joinWith[$sourceId])) {
         foreach ($this->_joinWith[$sourceId] as $targetId) {
             $targetTable = modelCollection::getInstanceById($targetId);
             $joins = modelStorage::getIndirectTablesJoins($sourceTable, $targetTable, $this->_joinType, $this->_joinWhere);
             foreach ($joins as $id => $joinString) {
                 $this->_join[$id] = $joinString;
                 $this->_alreadyJoined[$id] = true;
             }
             $this->_alreadyJoined[$targetId] = true;
             unset($this->_joinWith[$targetId]);
         }
     }
     // JOIN OTHER
     foreach ($this->_joinedTables as $targetId => $targetTable) {
         if ($rootId !== $targetId) {
             // && (!$alreadyJoined[$targetId]
             $min = null;
             $minJoins = false;
             // Trying to join table
             //echo '<div><b>'.$sourceTable->getTableName().' JOIN '.$table2->getTableName().'</b></div>';
             foreach ($this->_joinedTables as $xSourceId => $sourceTable) {
                 if ($xSourceId !== $targetId) {
                     $joins = modelStorage::getIndirectTablesJoins($sourceTable, $targetTable, $this->_joinType, $this->_joinWhere);
                     if ($joins !== false && ($min === null || count($joins) < $min)) {
                         $minJoins = $joins;
                         $min = count($joins);
                     }
                 }
             }
             if ($minJoins !== false) {
                 foreach ($minJoins as $id => $joinString) {
                     $this->_join[$id] = $joinString;
                     $this->_alreadyJoined[$id] = true;
                 }
             }
         }
     }
     //$this->_orderJoins($allJoins, $joinContent, $rootTableId);
 }
Example #3
0
 public static function setForeignKeysCache($filename)
 {
     self::$_foreignKeysCache = $filename;
 }
Example #4
0
<?php

$name = 'auth';
$title = 'Authentication & Authorization';
$description = 'Authentication & Authorization';
$autoload = array('authException' => 'authException.php', 'user' => 'classes/user.php', 'registeredUser' => 'models/registeredUser.php', 'userIdentityPrototype' => 'classes/userIdentityPrototype.php', 'openidUserIdentity' => 'openidIdentity/openidUserIdentity.php', 'userOpenid' => 'openidIdentity/userOpenid.php', 'LightOpenID' => 'openidIdentity/vendor/LightOpenID.php', 'loginUserIdentity' => 'loginIdentity/loginUserIdentity.php', 'userLogin' => 'loginIdentity/userLogin.php', 'emailUserIdentity' => 'emailIdentity/emailUserIdentity.php', 'userEmail' => 'emailIdentity/userEmail.php');
modelStorage::getInstance()->registerCollection('userLogin', 'user_login')->registerCollection('userEmail', 'user_email')->registerCollection('userOpenid', 'user_openid')->registerCollection('registeredUser', 'user');
Example #5
0
 /**
  *
  * @param string $storageName
  * @return modelStorage
  */
 public static function getModelStorage($storageName = 'default')
 {
     return modelStorage::getInstance($storageName);
 }
Example #6
0
 private function _getStorage()
 {
     return modelStorage::get(\get_class($this));
 }