public function addAction() { $form = new Form_Cadmin_ModelsAdd(); if ($this->_request->isPost()) { if ($this->_request->getPost()) { $form_values = $this->_request->getPost(); $model = new CcmModels(); $asset_type_id = $this->_em->find('CcmAssetTypes', $form_values['ccm_asset_sub_type']); $model->setCcmAssetType($asset_type_id); $ccm_make = $this->_em->find('CcmMakes', $form_values['ccm_make_id']); $model->setCcmMake($ccm_make); $model->setCcmModelName($form_values['ccm_model_name']); $model->setCatalogueId($form_values['catalogue_id']); $model->setGrossCapacity20($form_values['gross_capacity_20']); $model->setGrossCapacity4($form_values['gross_capacity_4']); $model->setNetCapacity20($form_values['net_capacity_20']); $model->setNetCapacity4($form_values['net_capacity_4']); $model->setAssetDimensionLength($form_values['asset_dimension_length']); $model->setAssetDimensionWidth($form_values['asset_dimension_width']); $model->setAssetDimensionHeight($form_values['asset_dimension_height']); $model->setCfcFree($form_values['cfc_free']); $user_id = $this->_em->find('Users', $this->_userid); $model->setCreatedBy($user_id); $model->setCreatedDate(App_Tools_Time::now()); $model->setModifiedBy($user_id); $model->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($model); $this->_em->flush(); } } $this->_redirect("/cadmin/manage-models"); }
public function setCatalogueId($catalogueId) { $this->__load(); return parent::setCatalogueId($catalogueId); }
public function addNewMakeModel() { // $this->form_values['ccm_make_popup']; $created_by = $this->_em->getRepository('Users')->find($this->_user_id); $ccm_make = new CcmMakes(); $ccm_make->setCcmMakeName($this->form_values['ccm_make_popup']); $ccm_make->setCreatedBy($created_by); $ccm_make->setModifiedBy($created_by); $ccm_make->setCreatedDate(new \DateTime(date("Y-m-d"))); $ccm_make->setModifiedDate(new \DateTime(date("Y-m-d"))); $this->_em->persist($ccm_make); $this->_em->flush(); $ccm_make_i = $ccm_make->getPkId(); $ccm_model = new CcmModels(); $ccm_voltage_regulator = new CcmVoltageRegulators(); $ccm_make_id = $this->_em->getRepository('CcmMakes')->find($ccm_make_i); $ccm_model->setCcmMake($ccm_make_id); $ccm_model->setCcmModelName($this->form_values['ccm_model_popup']); $ccm_model->setCatalogueId($this->form_values['catalogue_id_popup']); if (!empty($this->form_values['asset_dimension_height_popup'])) { $ccm_model->setAssetDimensionHeight($this->form_values['asset_dimension_height_popup']); } if (!empty($this->form_values['asset_dimension_length_popup'])) { $ccm_model->setAssetDimensionLength($this->form_values['asset_dimension_length_popup']); } if (!empty($this->form_values['asset_dimension_width_popup'])) { $ccm_model->setAssetDimensionWidth($this->form_values['asset_dimension_width_popup']); } if (!empty($this->form_values['internal_dimension_width_popup'])) { $ccm_model->setInternalDimensionWidth($this->form_values['internal_dimension_width_popup']); } if (!empty($this->form_values['internal_dimension_width_popup'])) { $ccm_model->setInternalDimensionWidth($this->form_values['internal_dimension_width_popup']); } if (!empty($this->form_values['internal_dimension_width_popup'])) { $ccm_model->setInternalDimensionWidth($this->form_values['internal_dimension_width_popup']); } if (!empty($this->form_values['storage_dimension_width_popup'])) { $ccm_model->setStorageDimensionWidth($this->form_values['storage_dimension_width_popup']); } if (!empty($this->form_values['storage_dimension_width_popup'])) { $ccm_model->setStorageDimensionWidth($this->form_values['storage_dimension_width_popup']); } if (!empty($this->form_values['storage_dimension_width_popup'])) { $ccm_model->setStorageDimensionWidth($this->form_values['storage_dimension_width_popup']); } if (!empty($this->form_values['net_capacity_4'])) { $ccm_model->setNetCapacity4($this->form_values['net_capacity_4']); } if (!empty($this->form_values['cold_life'])) { $ccm_model->setColdLife($this->form_values['cold_life']); } if (!empty($this->form_values['ccm_asset_type_id_popup'])) { $asset_id_m = $this->_em->getRepository('CcmAssetTypes')->find($this->form_values['ccm_asset_type_id_popup']); $ccm_model->setCcmAssetType($asset_id_m); } if (!empty($this->form_values['cfc_free'])) { $ccm_model->setCfcFree($this->form_values['cfc_free']); } if (!empty($this->form_values['is_pis_pqs'])) { $ccm_model->setIsPqs($this->form_values['is_pis_pqs']); } if (!empty($this->form_values['no_of_phases'])) { $ccm_model->setNoOfPhases($this->form_values['no_of_phases']); } if (!empty($this->form_values['refrigerator_gas_type'])) { $refrigerator_gas_type = $this->_em->getRepository('ListDetail')->find($this->form_values['refrigerator_gas_type']); $ccm_model->setGasType($refrigerator_gas_type); } if (!empty($this->form_values['product_price'])) { $ccm_model->setProductPrice($this->form_values['product_price']); } if (!empty($this->form_values['power_source'])) { $power_source = $this->_em->getRepository('ListDetail')->find($this->form_values['power_source']); $ccm_model->setPowerSource($power_source); } if (!empty($this->form_values['gross_capacity_4_popup'])) { $ccm_model->setGrossCapacity20($this->form_values['gross_capacity_4_popup']); } if (!empty($this->form_values['gross_capacity_4_popup'])) { $ccm_model->setGrossCapacity4($this->form_values['gross_capacity_4_popup']); } if (!empty($this->form_values['net_capacity_20_popup'])) { $ccm_model->setNetCapacity20($this->form_values['net_capacity_20_popup']); } if (!empty($this->form_values['net_capacity_4_popup'])) { $ccm_model->setNetCapacity4($this->form_values['net_capacity_4_popup']); } if (!empty($this->form_values['nominal_voltage'])) { $ccm_voltage_regulator->setNominalVoltage($this->form_values['nominal_voltage']); } if (!empty($this->form_values['continous_power'])) { $ccm_voltage_regulator->setContinousPower($this->form_values['continous_power']); } if (!empty($this->form_values['frequency'])) { $ccm_voltage_regulator->setFrequency($this->form_values['frequency']); } if (!empty($this->form_values['input_voltage_range'])) { $ccm_voltage_regulator->setInputVoltageRange($this->form_values['input_voltage_range']); } if (!empty($this->form_values['output_voltage_range'])) { $ccm_voltage_regulator->setOutputVoltageRange($this->form_values['output_voltage_range']); } $ccm_model->setStatus(1); $ccm_model->setCreatedBy($created_by); $ccm_model->setModifiedBy($created_by); $ccm_model->setCreatedDate(new \DateTime(date("Y-m-d"))); $ccm_model->setModifiedDate(new \DateTime(date("Y-m-d"))); $this->_em->persist($ccm_model); $this->_em->flush(); //$ccm_model_i = $ccm_model->getPkId(); // return $ccm_model_i; }