forked from symfony/form
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataAccessorInterface.php
50 lines (44 loc) · 1.57 KB
/
DataAccessorInterface.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
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form;
/**
* Writes and reads values to/from an object or array bound to a form.
*
* @author Yonel Ceruto <[email protected]>
*/
interface DataAccessorInterface
{
/**
* Returns the value at the end of the property of the object graph.
*
* @throws Exception\AccessException If unable to read from the given form data
*/
public function getValue(object|array $viewData, FormInterface $form): mixed;
/**
* Sets the value at the end of the property of the object graph.
*
* @throws Exception\AccessException If unable to write the given value
*/
public function setValue(object|array &$viewData, mixed $value, FormInterface $form): void;
/**
* Returns whether a value can be read from an object graph.
*
* Whenever this method returns true, {@link getValue()} is guaranteed not
* to throw an exception when called with the same arguments.
*/
public function isReadable(object|array $viewData, FormInterface $form): bool;
/**
* Returns whether a value can be written at a given object graph.
*
* Whenever this method returns true, {@link setValue()} is guaranteed not
* to throw an exception when called with the same arguments.
*/
public function isWritable(object|array $viewData, FormInterface $form): bool;
}