Automatic Rules Creation

Hi, im trying to create a code generator that creates automatic rules, im trying to use the function of the gii inside the model to automatize the creation of the rules , but the problem is that i cant call the functions of gii inside the model class , do you know how can i do this , how can i call gii functions inside the model?

The purpose of gii is not to do introspection at runtime, but to generate the appropriate class during development.

To use Gii functions, you should import the class files you need which should allow you to use them.

AweCrud/AweModel do refer to "Awe" Gii functions from the generated classes. You can have a look at that extension.

what sort of code generator are you developing if its something similar to gii why don’t you just add custom templates

I’ve already made my own templates , but every time i change something in the database , i need to rebuild the model, once i overwrited my code >__< , im trying to make a way to automatically get my model rules to make my work easyer.

How can i import the gii functions,

i’ve tryed







inside rules(){



but it didnt worked =/

I think proposes to create a base class for the models by default and an initial derived, public class.

This is what I use anyway, but I have made several changes to the way Awegen generates the classes to suit my needs and to integrate my know-how.

With that method you can generate the base classes (and overwrite the previous versions) because you are keeping your specific methods in the derived classes. I do it like that. I create a migration, perfect the migration in my dev environment, create the new BaseModelClass by overwriting the previous one, test and voilà, it’s done.