public static function factory($orderId) { $orm = new self(); $orm->orderId = (int) $orderId; $orm->populate(); if ($orm->type == self::TYPE_LAB_TEST) { $ormObj = new OrderLabTest(); $ormObj->orderId = $orm->orderId; $ormObj->populate(); } else { if ($orm->type == self::TYPE_IMAGING) { $ormObj = new OrderImaging(); $ormObj->orderId = $orm->orderId; $ormObj->populate(); } else { $ormObj = $orm; } } return $ormObj; }
public function processImagingAction() { $params = $this->_getParam('imaging'); $orderImaging = new OrderImaging(); if (isset($params['orderId'])) { $orderImaging->orderId = (int) $params['orderId']; $orderImaging->populate(); } $orderImaging->populateWithArray($params); if (isset($params['order'])) { $orderImaging->order->populateWithArray($params['order']); } $orderImaging->order->status = 'Active'; $orderImaging->order->dateTime = date('Y-m-d H:i:s'); if (!$orderImaging->order->providerId > 0) { $orderImaging->order->providerId = (int) Zend_Auth::getInstance()->getIdentity()->personId; } $orderImaging->persist(); $msg = __('Record saved'); $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct(array('msg' => $msg)); }