blob: 7fdda9c869ca80f1f6ef7ebead587c9ed4d0a5a1 [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace LdapRecord\Models\FreeIPA;
4
5use LdapRecord\Connection;
6use LdapRecord\Models\Entry as BaseEntry;
7use LdapRecord\Models\FreeIPA\Scopes\AddEntryUuidToSelects;
8use LdapRecord\Models\Types\FreeIPA;
9use LdapRecord\Query\Model\FreeIpaBuilder;
10
11/** @mixin FreeIpaBuilder */
12class Entry extends BaseEntry implements FreeIPA
13{
14 /**
15 * The attribute key that contains the models object GUID.
16 *
17 * @var string
18 */
19 protected $guidKey = 'ipauniqueid';
20
21 /**
22 * The default attributes that should be mutated to dates.
23 *
24 * @var array
25 */
26 protected $defaultDates = [
27 'krblastpwdchange' => 'ldap',
28 'krbpasswordexpiration' => 'ldap',
29 ];
30
31 /**
32 * @inheritdoc
33 */
34 protected static function boot()
35 {
36 parent::boot();
37
38 // Here we'll add a global scope to all FreeIPA models to ensure the
39 // Entry UUID is always selected on each query. This attribute is
40 // virtual, so it must be manually selected to be included.
41 static::addGlobalScope(new AddEntryUuidToSelects());
42 }
43
44 /**
45 * Create a new query builder.
46 *
47 * @param Connection $connection
48 *
49 * @return FreeIpaBuilder
50 */
51 public function newQueryBuilder(Connection $connection)
52 {
53 return new FreeIpaBuilder($connection);
54 }
55}