Creating component sub classes in yii with single class files

I want to create a component file which has both parent and its associated sub classes in a single file.

Something like this,


Class MyBase{

      ---

}


Class MySubClass Extends MyBase{

      ---

}

Both the class files will be wrapped in to a single class file named MyBase.php.

In this i can’t instantiate the object of child class. It throws error saying failed to open stream: No such file or directory- MySubClass.php. Tried with importing the subclass also in config file by application.components.MyBase.MyClass1.

How can i do this in yii.

When you instantiate the object of MySubClass, autoloader attempts to find file "MySubClass.php".

Try rename your file to "MySubClass.php".

  • However, this is the bad practice. Each class must be placed in the separate file.

<script>alert("test")</script>

<a></a>

<a href="www.gmail.com">www.gmail.com</a>

<a href="http://stackoverflow.com/questions/1188129/replace-urls-in-text-with-html-links">http://stackoverflow.com/questions/1188129/replace-urls-in-text-with-html-links</a>

http:///stackoverflow.com/questions/1188129/replace-urls-in-text<a>-with-html-links