This is a small ActiveRecord extension that recognises the properties defined in your class doc block and adds them dynamically to your record (if not already defined via attributes()
). You can also do an addAttribute('name')
at runtime and then that attribute will also be recognised.
For those amongst us having objects that differ heavily between 2 documents.
This basically contains what I was missing from the Yii1 yii-mongodb-suite's EMongoSoftDocument.
Requirements ¶
Yii 2 and the Yii2 Mongo extension. This is not a replacement but an addendum :)
Usage ¶
Include it in your composer.json:
"require": {
"bedezign/yii2-mongodb": "*",
}
After a composer update
, just derive your Model of the ActiveRecord included and get going. It won't interfere in normal operations.
class MyClass extends \bedezign\yii2\mongodb\ActiveRecord
{
}
State ¶
The extension is only the one file and for me personally it does what I need. I figured there might be some other people out there with use for it. That being said, if there is something not working or you think that should be added, let me know.
Downloading ¶
You can find it on github
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.