forked from sstok/gush-experiments-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFieldSetBuilderInterface.php
81 lines (73 loc) · 2.54 KB
/
FieldSetBuilderInterface.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/*
* This file is part of the RollerworksSearch package.
*
* (c) Sebastiaan Stok <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Rollerworks\Component\Search;
use Rollerworks\Component\Search\Exception\BadMethodCallException;
use Rollerworks\Component\Search\Exception\UnexpectedTypeException;
/**
* @author Sebastiaan Stok <[email protected]>
*/
interface FieldSetBuilderInterface
{
/**
* Add a field to the set-builder.
*
* Note. The possibility to pass a FieldTypeInterface as $type is deprecated
* since 1.0.0-beta5 and will be removed in 2.0
*
* Its possible to also pass in a FieldTypeInterface
*
* @param string|FieldConfigInterface $field Name of search field or an actual search field
* object
* @param string $type Field type-name
* @param array $options Array of options for building the field
* @param bool $required Is the field required in a ValuesGroup and must it
* always have a value (default is false)
* @param string $modelClass Optional Model class-name reference
* @param string $modelProperty Model property reference
*
* @throws BadMethodCallException When the FieldSet has been already turned into a FieldSet instance
* @throws UnexpectedTypeException
*
* @return self
*/
public function add($field, $type = null, array $options = [], $required = false, $modelClass = null, $modelProperty = null);
/**
* Remove a field from the set-builder.
*
* @param string $name
*
* @throws BadMethodCallException When the FieldSet has been already turned into a FieldSet instance
*
* @return FieldSetBuilderInterface
*/
public function remove($name);
/**
* Returns whether the set-builder has a field with the name.
*
* @param string $name
*
* @return bool
*/
public function has($name);
/**
* Get a previously registered field from the set.
*
* @param string $name
*
* @return FieldConfigInterface
*/
public function get($name);
/**
* Create the FieldSet using the fields set on the builder.
*
* @return FieldSet
*/
public function getFieldSet();
}