1 | <?php |
||
24 | class PersistenceManager |
||
25 | { |
||
26 | /** |
||
27 | * @var FormObject |
||
28 | */ |
||
29 | protected $formObject; |
||
30 | |||
31 | /** |
||
32 | * @var bool |
||
33 | */ |
||
34 | protected $initializationDone = false; |
||
35 | |||
36 | /** |
||
37 | * @param FormObject $formObject |
||
38 | */ |
||
39 | public function __construct(FormObject $formObject) |
||
43 | |||
44 | /** |
||
45 | * Loops on the registered persistence services and saves the given form |
||
46 | * instance in each one. |
||
47 | * |
||
48 | * @param FormIdentifierObject $identifierObject |
||
49 | * @param FormInterface $form |
||
50 | */ |
||
51 | public function save(FormIdentifierObject $identifierObject, FormInterface $form) |
||
73 | |||
74 | /** |
||
75 | * Loops on the registered persistence services, and tries to fetch the |
||
76 | * form. If a form is found, it is returned and the loop breaks. If not form |
||
77 | * is found, `null` is returned. |
||
78 | * |
||
79 | * @param FormIdentifierObject $identifierObject |
||
80 | * @return FormInterface|null |
||
81 | * @throws InvalidEntryException |
||
82 | */ |
||
83 | public function fetchFirst(FormIdentifierObject $identifierObject) |
||
101 | |||
102 | /** |
||
103 | * Will remove the old identifier objects on every persistence service that |
||
104 | * has it, and replace it with the new identifier object. |
||
105 | * |
||
106 | * @param FormIdentifierObject $oldIdentifierObject |
||
107 | * @param FormIdentifierObject $newIdentifierObject |
||
108 | * @param FormInterface $form |
||
109 | */ |
||
110 | protected function refreshFormIdentifier(FormIdentifierObject $oldIdentifierObject, FormIdentifierObject $newIdentifierObject, FormInterface $form) |
||
120 | |||
121 | /** |
||
122 | * Loops on persistence services and initializes them. |
||
123 | */ |
||
124 | protected function initializePersistence() |
||
134 | |||
135 | /** |
||
136 | * Sorts the persistence services, based on their priority property: the |
||
137 | * ones with the highest priority will come first. |
||
138 | * |
||
139 | * @return PersistenceInterface[] |
||
140 | */ |
||
141 | protected function getSortedPersistence() |
||
158 | } |
||
159 |