Skip to content

Commit 34b486e

Browse files
committed
Some updates after public review
1 parent 8944b33 commit 34b486e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cookbook/form/dynamic_form_modification.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ creating that particular field is delegated to an event listener::
100100
$builder->add('price');
101101

102102
$builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) {
103-
// adding the name field if needed
103+
// ... adding the name field if needed
104104
});
105105
}
106106

@@ -121,9 +121,9 @@ the event listener might look like the following::
121121
$form = $event->getForm();
122122

123123
// check if the Product object is "new"
124-
// If you didn't pass any data to the form, the data is "null".
124+
// If no data is passed to the form, the data is "null".
125125
// This should be considered a new "Product"
126-
if (!$product || !$product->getId()) {
126+
if (!$product || null !== $product->getId()) {
127127
$form->add('name', 'text');
128128
}
129129
});
@@ -212,7 +212,7 @@ class::
212212
$product = $event->getData();
213213
$form = $event->getForm();
214214

215-
if (!$product || !$product->getId()) {
215+
if (!$product || null !== $product->getId()) {
216216
$form->add('name', 'text');
217217
}
218218
}

0 commit comments

Comments
 (0)