public function generate (stdClass $data)
    {
        $files = [];

        $this->createFileFromTemplate ([
            "destination"         => $data->formValidationDestination,
            "templateDestination" => __DIR__ . '/../templates/service/validator.hctpl',
            "content"             => [
                "formValidationNameSpace" => $data->formValidationNameSpace,
                "formValidationName"      => $data->formValidationName,
                "formRules"               => $this->getRules ($data->mainModel, array_merge ($this->getAutoFill (), ['id']), false),
            ],
        ]);

        $files[] = $data->formValidationDestination;

        if (isset($data->mainModel->multiLanguage)) {

            $this->createFileFromTemplate ([
                "destination"         => $data->formTranslationsValidationDestination,
                "templateDestination" => __DIR__ . '/../templates/service/validator.hctpl',
                "content"             => [
                    "formValidationNameSpace" => $data->formValidationNameSpace,
                    "formValidationName"      => $data->formTranslationsValidationName,
                    "formRules"               => $this->getRules ($data->mainModel->multiLanguage, array_merge ($this->getAutoFill (), ['id', 'record_id', 'language_id']), true),
                ],
            ]);

            $files[] = $data->formTranslationsValidationDestination;
        }

        return $files;
    }
public function generate (stdClass $data)
    {
        $files = [];

        $this->createFileFromTemplate ([
            "destination"         => $data->formValidationDestination,
            "templateDestination" => __DIR__ . '/../templates/service/validator.hctpl',
            "content"             => [
                "formValidationNameSpace" => $data->formValidationNameSpace,
                "formValidationName"      => $data->formValidationName,
                "formRules"               => $this->getRules ($data->mainModel, array_merge ($this->getAutoFill (), ['id']), false),
            ],
        ]);

        $files[] = $data->formValidationDestination;

        if (isset($data->mainModel->multiLanguage)) {

            $this->createFileFromTemplate ([
                "destination"         => $data->formTranslationsValidationDestination,
                "templateDestination" => __DIR__ . '/../templates/service/validator.hctpl',
                "content"             => [
                    "formValidationNameSpace" => $data->formValidationNameSpace,
                    "formValidationName"      => $data->formTranslationsValidationName,
                    "formRules"               => $this->getRules ($data->mainModel->multiLanguage, array_merge ($this->getAutoFill (), ['id', 'record_id', 'language_id']), true),
                ],
            ]);

            $files[] = $data->formTranslationsValidationDestination;
        }

        return $files;
    }
public function generate ( stdClass $ data ) { $ files = [ ] ; $ this -> createFileFromTemplate ( [ "destination" => $ data -> formValidationDestination , "templateDestination" => __DIR__ . '/../templates/service/validator.hctpl' , "content" => [ "formValidationNameSpace" => $ data -> formValidationNameSpace , "formValidationName" => $ data -> formValidationName , "formRules" => $ this -> getRules ( $ data -> mainModel , array_merge ( $ this -> getAutoFill ( ) , [ 'id' ] ) , false ) , ] , ] ) ; $ files [ ] = $ data -> formValidationDestination ; if ( isset ( $ data -> mainModel -> multiLanguage ) ) { $ this -> createFileFromTemplate ( [ "destination" => $ data -> formTranslationsValidationDestination , "templateDestination" => __DIR__ . '/../templates/service/validator.hctpl' , "content" => [ "formValidationNameSpace" => $ data -> formValidationNameSpace , "formValidationName" => $ data -> formTranslationsValidationName , "formRules" => $ this -> getRules ( $ data -> mainModel -> multiLanguage , array_merge ( $ this -> getAutoFill ( ) , [ 'id' , 'record_id' , 'language_id' ] ) , true ) , ] , ] ) ; $ files [ ] = $ data -> formTranslationsValidationDestination ; } return $ files ; }
Generating validator files

@param stdClass $data
@return array
Generating validator files