blob: b2dec28ce20b009ed22d644a063844d7010f7e0b [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace LdapRecord\Query;
4
5use LdapRecord\LdapRecordException;
6
7class ObjectNotFoundException extends LdapRecordException
8{
9 /**
10 * The query filter that was used.
11 *
12 * @var string
13 */
14 protected $query;
15
16 /**
17 * The base DN of the query that was used.
18 *
19 * @var string
20 */
21 protected $baseDn;
22
23 /**
24 * Create a new exception for the executed filter.
25 *
26 * @param string $query
27 * @param null $baseDn
28 *
29 * @return static
30 */
31 public static function forQuery($query, $baseDn = null)
32 {
33 return (new static())->setQuery($query, $baseDn);
34 }
35
36 /**
37 * Set the query that was used.
38 *
39 * @param string $query
40 * @param string|null $baseDn
41 *
42 * @return $this
43 */
44 public function setQuery($query, $baseDn = null)
45 {
46 $this->query = $query;
47 $this->baseDn = $baseDn;
48 $this->message = "No LDAP query results for filter: [$query] in: [$baseDn]";
49
50 return $this;
51 }
52}