Ejemplo n.º 1
0
 /**
  *
  * @return array
  */
 public function updateAction()
 {
     if ($this->getRequest()->isPost()) {
         $rangeAndVolumes = $this->getRequest()->getParam('rangeAndVolumes');
         $rangeAndVolumeQuery = RangeAndVolumeQuery::create()->find();
         try {
             $this->getRangeAndVolumeCatalog()->beginTransaction();
             while ($rangeAndVolume = $rangeAndVolumeQuery->read()) {
                 $this->getRangeAndVolumeCatalog()->deleteById($rangeAndVolume->getIdRangeAndVolume());
             }
             foreach ($rangeAndVolumes as $values) {
                 $rangeAndVolume = new RangeAndVolume();
                 RangeAndVolumeFactory::populate($rangeAndVolume, $values);
                 $this->getRangeAndVolumeCatalog()->create($rangeAndVolume);
             }
             $this->getRangeAndVolumeCatalog()->commit();
             $this->setFlash('ok', $this->i18n->_("Se actualizo correctamente el RangeAndVolume"));
         } catch (Exception $e) {
             $this->getRangeAndVolumeCatalog()->rollBack();
             $this->setFlash('error', $this->i18n->_($e->getMessage()));
         }
     }
     $this->_redirect('range-and-volume/edit');
 }
Ejemplo n.º 2
0
 /**
  *
  * makeBean
  * @param array $resultset
  * @return \Application\Model\Bean\RangeAndVolume
  */
 protected function makeBean($resultset)
 {
     return RangeAndVolumeFactory::createFromArray($resultset);
 }