/** * Generates a Query Exception * @param string $message * @param int $code * @param string $caller Caller class' name */ public function __construct($message = 'An exception occured', $code = 1, $forceExit = false) { if ($forceExit) { die('Security : ' . \Orion\Core\Security::preventInjection($message)); exit(1); } parent::__construct((string) $message, $code, 'Security'); }
/** * /!\ This method is experimental and should be used only if you know what you are doing. * Query chain element, joining provided $table to the query. * This method does not require a bound model. * But the downside is that you won't have any object formating or column aliasing, so be careful with overlaps. * @param string $link A table name. * @param string $leftfield The field from the current table * @param string $rightfield The field from the joined table * @param string $type [LEFT|RIGHT|INNER|OUTER] */ public function &joinTable($table, $leftfield, $rightfield, $type = 'LEFT') { if (empty($table) || empty($leftfield) || empty($rightfield)) { throw new Core\Exception('Missing arguments while trying to join [' . Core\Security::preventInjection($table) . '].'); } if (!Core\Tools::match($type, '(natural )?((inner|cross)|(left|right)( outer)?)?', 'i')) { throw new Core\Exception('Invalid join type while trying to join [' . Core\Security::preventInjection($table) . '].'); } $this->_JOIN_TABLE[$table] = array($leftfield, $rightfield, $type); return $this; }