| Server IP : 37.9.174.138 / Your IP : 216.73.216.117 Web Server : Apache System : Linux vps6.backend.sk 6.12.100+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.100-1 (2026-07-30) x86_64 User : ftpuser ( 1001) PHP Version : 8.4.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/ttjs.cz/dev/app/classes/ |
Upload File : |
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
namespace app\classes;
/**
* Description of MNRelation
*
* @author pegas
*/
abstract class MNRelation extends PDOElement {
public function __construct($id, $table, array $bindArray = array(), $idColumnName = "id", $condition = false, $customSelection = false) {
parent::__construct($id, $table, $bindArray, $idColumnName, $condition, $customSelection, true);
$this->id = $this->element[$idColumnName];
}
/**
* @return \app\classes\MNRelation
*/
protected static function getMNRelationPrototype(...$args) {
$class = get_called_class();
try {
if (!method_exists($class, 'addRelation')) {
throw new \Exception($class . "::addRelation", \app\constants\ResponseCodes::METHOD_NOT_IMPLEMENTED);
}
call_user_func_array($class . '::addRelation', $args);
$reflect = new \ReflectionClass($class);
$instance = $reflect->newInstanceArgs($args);
} catch (\Exception $ex) {
if ($ex->getCode() === 1062 || intval($ex->getCode()) === 23000) {
$reflect = new \ReflectionClass($class);
$instance = $reflect->newInstanceArgs($args);
} else {
throw new \Exception($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
}
}
return $instance;
}
public function isEnabled() {
return $this->_get("state") === \app\constants\State::ACTIVE;
}
public function enable() {
$this->update(array("state" => \app\constants\State::ACTIVE));
}
public function disable() {
$this->update(array("state" => \app\constants\State::DISABLED));
}
}