-
-
Notifications
You must be signed in to change notification settings - Fork 900
/
Copy pathOptions.php
60 lines (49 loc) · 1.57 KB
/
Options.php
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
<?php
/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace ApiPlatform\Doctrine\Orm\State;
use ApiPlatform\Doctrine\Common\State\Options as CommonOptions;
use ApiPlatform\State\OptionsInterface;
class Options extends CommonOptions implements OptionsInterface
{
/**
* @param string|callable $handleLinks experimental callable, typed mixed as we may want a service name in the future
* @param string|callable $transformEntity experimental callable, typed mixed as we may want a service name in the future
*
* @see LinksHandlerInterface
*/
public function __construct(
protected ?string $entityClass = null,
mixed $handleLinks = null,
mixed $transformEntity = null,
) {
parent::__construct(handleLinks: $handleLinks, transformModel: $transformEntity);
}
public function getEntityClass(): ?string
{
return $this->entityClass;
}
public function withEntityClass(?string $entityClass): self
{
$self = clone $this;
$self->entityClass = $entityClass;
return $self;
}
public function getTransformDocument(): mixed
{
return $this->getTransformModel();
}
public function withTransformDocument(mixed $transformEntity): self
{
$self = clone $this;
$self->transformModel = $transformEntity;
return $self;
}
}