1 | <?php |
||
24 | class PersistenceManager |
||
25 | { |
||
26 | /** |
||
27 | * @var FormObject |
||
28 | */ |
||
29 | protected $formObject; |
||
30 | |||
31 | /** |
||
32 | * @var bool |
||
33 | */ |
||
34 | protected $formIsPersistent = false; |
||
35 | |||
36 | /** |
||
37 | * @var bool |
||
38 | */ |
||
39 | protected $initializationDone = false; |
||
40 | |||
41 | /** |
||
42 | * @param FormObject $formObject |
||
43 | */ |
||
44 | public function __construct(FormObject $formObject) |
||
48 | |||
49 | /** |
||
50 | * Loops on the registered persistence services and saves the given form |
||
51 | * instance in each one. |
||
52 | * |
||
53 | * @param FormInterface $form |
||
54 | */ |
||
55 | public function save(FormInterface $form) |
||
80 | |||
81 | /** |
||
82 | * Loops on the registered persistence services, and tries to fetch the |
||
83 | * form. If a form is found, it is returned and the loop breaks. If not form |
||
84 | * is found, `null` is returned. |
||
85 | * |
||
86 | * @param FormMetadata $metadata |
||
87 | * @return FormInterface|null |
||
88 | * @throws InvalidEntryException |
||
89 | */ |
||
90 | public function fetchFirst(FormMetadata $metadata) |
||
110 | |||
111 | /** |
||
112 | * Loops on persistence services and initializes them. |
||
113 | */ |
||
114 | protected function initializePersistence() |
||
124 | |||
125 | /** |
||
126 | * Sorts the persistence services, based on their priority property: the |
||
127 | * ones with the highest priority will come first. |
||
128 | * |
||
129 | * @return PersistenceInterface[] |
||
130 | */ |
||
131 | protected function getSortedPersistenceServices() |
||
148 | |||
149 | /** |
||
150 | * @return bool |
||
151 | */ |
||
152 | public function formIsPersistent() |
||
156 | } |
||
157 |