-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathSearchTerms.php
More file actions
76 lines (65 loc) · 2.08 KB
/
SearchTerms.php
File metadata and controls
76 lines (65 loc) · 2.08 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
65
66
67
68
69
70
71
72
73
74
75
76
<?php
declare(strict_types=1);
/**
* This source file is available under the terms of the
* Pimcore Open Core License (POCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
* @license Pimcore Open Core License (POCL)
*/
namespace Pimcore\Bundle\StudioBackendBundle\Gdpr\Attribute\Request;
use OpenApi\Attributes\Property;
use OpenApi\Attributes\Schema;
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\InvalidArgumentException;
use Symfony\Component\Validator\Constraints\Type;
/**
* @internal
*/
#[Schema(
title: 'GDPR Search Terms',
description: 'Object containing the values to search for. All fields are optional.',
type: 'object'
)]
final readonly class SearchTerms
{
public function __construct(
#[Property(description: 'The ID to search for.', type: 'string', nullable: true)]
#[Type('string')]
public ?string $id = null,
#[Property(description: 'The first name to search for.', type: 'string', nullable: true)]
#[Type('string')]
public ?string $firstname = null,
#[Property(description: 'The last name to search for.', type: 'string', nullable: true)]
#[Type('string')]
public ?string $lastname = null,
#[Property(description: 'The email address to search for.', type: 'string', nullable: true)]
#[Type('string')]
public ?string $email = null,
) {
if ($this->id === null &&
$this->firstname === null &&
$this->lastname === null &&
$this->email === null
) {
throw new InvalidArgumentException('Provide at least one search term.');
}
}
public function getId(): ?string
{
return $this->id;
}
public function getFirstname(): ?string
{
return $this->firstname;
}
public function getLastname(): ?string
{
return $this->lastname;
}
public function getEmail(): ?string
{
return $this->email;
}
}