• 1
Votes
name

As I delve a little deeper into Yii I'm now wondering if relying on Gii and Giix to generate my models and "admin" CRUD may be a crutch rather than a time-saving tool. Many times in the beginning stages of small projects it helps me get going more quickly, allowing me to focus on database design. However, whenever I make a change to my table structure or relations, I find myself having to rely on GiiX to re-generate the model. Before I do so, I always copy the parts of the model that I have written so that I can paste it into the updated model later. This seems like a tedious thing to do and I'm now wondering if it is saving me any actual time. I have a few questions:

  1. For Yii users specifically, once you've been doing Yii for a while do you even bother with Gii or GiiX? Did you quit using it because it was no longer useful, or because it was a crutch? Did you work on writing your own code generation and scaffolding tools?
  2. For all coders, do you feel code generation tools should be avoided when learning a new language or framework?

My hope is that there is an effective way to use Gii and other code generation tools even after updating table structure multiple times and writing in my own code, sans the copying and pasting and keeping track of what's what.

Please let me know your thoughts!

I don't know if it's possible with Yii but with another framework that I use we extend the model classes and put our custom code into those extended classes. In the app we only reference the extended class, not the base (generated) model classes.

Since we don't put any custom code into the base model classes they can be re-generated without worrying about overwriting any custom code.

  • 0
Reply Report