Skip to content

Commit

Permalink
Merge pull request #2 from thestanislav/hotfix/patch-1
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
fabiocarneiro committed Nov 21, 2013
2 parents 13419ba + 36d7c3c commit 016f572
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/FhcsFormTest/Controller/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function indexAction() {
$freight->addProduct($product).
$order->addFreight($freight);

$form = $this->getFormElementManager()->get('FhcsFormTest\Form\SomeForm');
$form = $this->getFormElementManager()->get('FhcsFormTest\Form\OrderFieldset');
$form->bind($order);

return array('form' => $form);
Expand Down
11 changes: 6 additions & 5 deletions src/FhcsFormTest/Form/FreightFieldset.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
use DoctrineModule\Stdlib\Hydrator\DoctrineObject as DoctrineHydrator;

class FreightFieldset extends Fieldset {

protected $entityManager;

public function getEntityManager() {
return $this->entityManager;
}

public function setEntityManager($entityManager) {
$this->entityManager = $entityManager;
}

public function init(){
$this->setHydrator(new DoctrineHydrator($this->getEntityManager(), 'FhcsFormTest\Entity\Freight'))->setObject(new Freight());
$this->setHydrator(new DoctrineHydrator($this->getEntityManager()));

$this->add(array(
'type' => 'Zend\Form\Element\Collection',
'name' => 'products',
Expand All @@ -30,5 +30,6 @@ public function init(){
)
)
));
$this->get('products')->setHydrator(new DoctrineHydrator($this->getEntityManager()));
}
}
9 changes: 5 additions & 4 deletions src/FhcsFormTest/Form/OrderFieldset.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace FhcsFormTest\Form;

use Zend\Form\Fieldset;
use Zend\Form\Form;
use FhcsFormTest\Entity\Order;
use DoctrineModule\Stdlib\Hydrator\DoctrineObject as DoctrineHydrator;

class OrderFieldset extends Fieldset{
class OrderFieldset extends Form{

protected $entityManager;

public function getEntityManager() {
return $this->entityManager;
}
Expand All @@ -29,5 +29,6 @@ public function init(){
)
)
));
$this->get('freights')->setHydrator(new DoctrineHydrator($this->getEntityManager()));
}
}
2 changes: 1 addition & 1 deletion src/FhcsFormTest/Form/ProductFieldset.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function setEntityManager($entityManager) {

public function init() {

$this->setHydrator(new DoctrineHydrator($this->getEntityManager(), 'FhcsFormTest\Entity\Product'))->setObject(new Product());
$this->setHydrator(new DoctrineHydrator($this->getEntityManager(), 'FhcsFormTest\Entity\Product'));

$this->add(array(
'type' => 'text',
Expand Down

0 comments on commit 016f572

Please sign in to comment.