Exemplo n.º 1
0
 public function makeCrudModelsAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     /** PARAMS **/
     $sql = '';
     $fields = array('img_id', 'cash_s_flat_fee', 'cash_s_percentage_fee', 'cash_s_minimum_fee', 'cash_s_fee_type', 'cash_b_flat_fee', 'cash_b_percentage_fee', 'cash_b_minimum_fee', 'cash_b_fee_type', 'tc_s_flat_fee', 'tc_s_percentage_fee', 'tc_s_minimum_fee', 'tc_s_fee_type', 'tc_b_flat_fee', 'tc_b_percentage_fee', 'tc_b_minimum_fee', 'tc_b_fee_type', 'cheque_s_flat_fee', 'cheque_s_percentage_fee', 'cheque_s_minimum_fee', 'cheque_s_fee_type', 'cheque_b_flat_fee', 'cheque_b_percentage_fee', 'cheque_b_minimum_fee', 'cheque_b_fee_type');
     function makeCamelCase($in)
     {
         $out = ucfirst($in);
         preg_match('/_/', $in, $matches);
         if (!empty($matches)) {
             $outArray = explode('_', $in);
             $out = '';
             foreach ($outArray as $outArraySingle) {
                 $out .= ucfirst($outArraySingle);
             }
         }
         return $out;
     }
     $result = '';
     foreach ($fields as $field) {
         $fieldCamel = makeCamelCase($field);
         preg_match('/_/', $field, $matches);
         if (!empty($matches)) {
             $fieldCamelArray = explode('_', $field);
             $fieldCamel = '';
             foreach ($fieldCamelArray as $fieldCamelSingle) {
                 $fieldCamel .= ucfirst($fieldCamelSingle);
             }
         }
         $result .= "\n        " . $field . ": {\n           required: true\n       },";
     }
     echo $result;
 }
Exemplo n.º 2
0
    ' . $sql . ' 
    */

    public function setId($id)
    {
        $this->id = $id;
        return $this;
    }

    public function getId()
    {
        return $this->_data["id"];
    }
';
foreach ($fields as $field) {
    $fieldCamel = makeCamelCase($field);
    preg_match('/_/', $field, $matches);
    if (!empty($matches)) {
        $fieldCamelArray = explode('_', $field);
        $fieldCamel = '';
        foreach ($fieldCamelArray as $fieldCamelSingle) {
            $fieldCamel .= ucfirst($fieldCamelSingle);
        }
    }
    $result .= '
    public function set' . $fieldCamel . '($' . $field . ')
    {
        $this->' . $field . ' = $' . $field . ';
        return $this;
    }