I recently re-organized my application code-base into several modules and nested sub-modules. I imported all the appropriate paths and added these modules/sub-modules in the configuration file as well. Immediately following this change, something strange is happening. Anytime I instantiate one new object of some of the classes, two or more objects of that class are created and a save() on that object inserts two or more identical records of the object in the DB as well. That is, if i do
$model = new Model()
and look at the object in NetBeans, two or more CLASSNAME strings of that class appear. As I move through the code, the number of CLASSNAME strings sometime increases. Ultimately, when the save() is called on the object, two or more of these identical records are saved in DB. This happens only with a few classes and these classes are in different modules/sub-modules.
The only common thread across these classes is that public class variables are declared in them. If I comment out the public class variables, initialize a new object and save it, things work fine. For all classes that don’t have any public class variables, everything works as it should.
When debugging a new object initialization, I tried stepping into YiiBase::autoload() function but couldn’t track the problem. After several hours, I am quite clueless about what is happening. Can someone please help?