Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bind entity in factory

  • Loading branch information...
commit 76dcbd6179b20549865cc219fe16b81c35a92b65 1 parent b63526f
@weierophinney authored
View
5 src/PhlyPeep/Controller/PeepController.php
@@ -49,9 +49,8 @@ public function submitAction()
throw new \DomainException('Unknown authenticated user type encountered');
}
- $peep = new Model\PeepEntity();
- $form = Model\PeepForm::factory($peep);
- $form->bind($peep);
+ $peep = new Model\PeepEntity();
+ $form = Model\PeepForm::factory($peep);
$request = $this->getRequest();
$data = $request->getPost();
View
6 src/PhlyPeep/Model/PeepForm.php
@@ -12,6 +12,7 @@ public static function factory(PeepEntity $peep = null)
if (null === $peep) {
$peep = __NAMESPACE__ . '\PeepEntity';
}
+
$builder = new AnnotationBuilder();
$form = $builder->createForm($peep);
@@ -25,6 +26,11 @@ public static function factory(PeepEntity $peep = null)
'value' => 'Peep!',
),
));
+
+ if ($peep instanceof PeepEntity) {
+ $form->bind($peep);
+ }
+
return $form;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.