Mongod Db

I’m using YiiMongoDbSuite in my project, and hope here is anyone who had experience with it.

in official site there is nice tutorial exactly what i’m looking for, but I have a question about this approach…

Before i was found it, I have implemented my own solution and it would be good if you could let me know your thoughts about it.

By that link (see above) the author makes decision about what model should be initialized internally (in class). it’s good enough. But would it be correct (from OOP side) if I will make the same but externally, like this

		$class = class_exists($type) ? $type : 'Client';

		if (!($clients = Client::model($class)->findAll($criteria)) {

			throw new CHttpExcetion(404, 'can not find required clients');


Why it is bad or good ?


the usage is a design pattern see here sigleTableInheritance


Yes this is what YMBS author suggest to do also.

But my question what’s the big difference between my and his approach ?