public function __construct(array $properties = null, $loadMappings = DatabaseRecord::MAPPINGS_NO_LAZY) { parent::__construct($properties, $loadMappings); if (is_array($this->Roles)) { foreach ($this->Roles as $role) { $this->roleTypes[] = $role->Type; } } }
<?php define("PHP_EXT", '.php'); define('PROJ_PATH', '/home/artem/server/nginx/www/book/'); define('VIEWS_PATH', PROJ_PATH . 'app/views/'); define('CORE_PATH', PROJ_PATH . 'app/core/'); require_once PROJ_PATH . 'app/config.php'; require_once CORE_PATH . 'exceptions.php'; require_once CORE_PATH . 'base/Model.php'; require_once CORE_PATH . 'base/View.php'; require_once CORE_PATH . 'base/Controller.php'; require_once CORE_PATH . 'base/Router.php'; require_once CORE_PATH . 'db/DatabaseRecord.php'; try { $db = new PDO("mysql:" . "dbname=" . $config['db']['name'] . ";host=" . $config['db']['host'], $config['db']['user'], $config['db']['pass']); $db->exec("SET NAMES SET" . $config['character']); DatabaseRecord::setDatabase($db); } catch (PDOException $e) { echo "PDO error: " . $e->getMessage() . "\n"; } $router = new Router(); try { $router->startRouting(); } catch (NotFoundException $e) { Controller::redirectTo404($_SERVER['REQUEST_URI']); }
/** * Charge dans $_SESSION les valeurs des champs du recordset * /!\ Cette fonction ne doit plus être utilisée /!\ * @deprecated since version 3.0 * @param string $paramTableName nom de la table dont il faut charger le recordset */ function mysql_table_load($paramTableName) { $KeyValue = $_SESSION[DatabaseDescription::getTableKeyName($paramTableName)]; if ($KeyValue) { $recordset = new DatabaseRecord($paramTableName, $KeyValue); $fields = $recordset->getFieldsArray(); foreach ($fields as $key => $value) { /** * Exportation de la valeur de la variable dans * Une variable globale accessible hors de la fonction * Formatage des données pour préparation à intégration dans MySQL * * TRES TRES SALE !! */ $GLOBALS[$key] = $value; } } return $recordset; }
public static function setDatabase(PDO $db, $charset = self::DEFAULT_CHARSET) { try { self::$db = $db; } catch (PDOException $e) { echo "Error connect to DB: " . $e->getMessage() . "\n"; } self::setNames($charset); self::checkDatabase(); self::$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); }
public function __construct() { parent::__construct('ResourceObjectMetaData', DatabaseRecord::INVALID_RECORD_ID); }
<?php define("PHP_EXT", '.php'); define('APP_PATH', __DIR__ . '/'); define('VIEWS_PATH', APP_PATH . 'views/'); define('CORE_PATH', APP_PATH . 'core/'); define('TOOLS_PATH', CORE_PATH . 'tools/'); require_once APP_PATH . 'config.php'; require_once CORE_PATH . 'exceptions.php'; require_once CORE_PATH . 'systemFunctions.php'; require_once CORE_PATH . 'base/Model.php'; require_once CORE_PATH . 'base/View.php'; require_once CORE_PATH . 'base/Controller.php'; require_once CORE_PATH . 'base/App.php'; require_once CORE_PATH . 'db/DatabaseRecord.php'; try { $db = new PDO("mysql:" . "dbname=" . $config['db']['name'] . ';' . "host=" . $config['db']['host'], $config['db']['user'], $config['db']['pass']); DatabaseRecord::setDatabase($db, $config['character']); } catch (PDOException $e) { echo "PDO error: " . $e->getMessage() . "\n"; } $app = new App($config); try { $app->run(); } catch (NotFoundException $e) { Controller::redirectTo404(explode('?', $_SERVER['REQUEST_URI'])[0]); }
public function __construct() { parent::__construct('TextObject', DatabaseRecord::INVALID_RECORD_ID); }
/** * Creates combined record object by relevant database live-record and version-record rows. * * @param string $table Name of the database table * @param array $liveRow The relevant datbase live-record row * @param array $versionRow The relevant database version-record row * @return \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord */ public static function createFromArrays($table, array $liveRow, array $versionRow) { $liveRecord = DatabaseRecord::createFromArray($table, $liveRow); $versionRecord = DatabaseRecord::createFromArray($table, $versionRow); return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord::class, $table, $liveRecord, $versionRecord); }
public static function setDatabase(PDO $db) { try { self::$db = $db; } catch (PDOException $e) { echo "Error connect to DB: " . $e->getMessage() . "\n"; } self::setEncording(); }
public function __construct() { parent::__construct('ClientApplication', DatabaseRecord::INVALID_RECORD_ID); }
public function __construct() { parent::__construct(); }
public function __construct() { parent::__construct('AccessRights', DatabaseRecord::INVALID_RECORD_ID); }