-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathException.php
More file actions
64 lines (49 loc) · 1.31 KB
/
Exception.php
File metadata and controls
64 lines (49 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
declare(strict_types=1);
/*
* This file is part of the QuidPHP package <https://quidphp.com>
* Author: Pierre-Philippe Emond <emondpph@gmail.com>
* License: https://github.com/quidphp/orm/blob/master/LICENSE
*/
namespace Quid\Orm;
use Quid\Main;
// exception
// class used for a database query exception
class Exception extends Main\Exception
{
// config
protected static array $config = [
'code'=>33, // code de l'exception
'query'=>false // affiche la query
];
// dynamique
protected ?string $query = null; // conserve la requête sql sous forme de string
// setQuery
// lie la query à l'exception
final public function setQuery(string $value)
{
$this->query = $value;
return $this;
}
// getQuery
// retourne la query
final public function getQuery():?string
{
return $this->query;
}
// content
// retourne la query si showQuery est true, sinon retourne null
final public function content():?string
{
return ($this->getAttr('query') === true)? $this->query:null;
}
// showQuery
// affiche ou non la requête sql dans le message
final public static function showQuery(bool $value):void
{
static::$config['query'] = $value;
}
}
// init
Exception::__init();
?>