yii2-mongodb Dynamic properties for the Yii2 MongoDB functionality

  1. Requirements
  2. Usage
  3. State
  4. Downloading

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.


Yii 2 and the Yii2 Mongo extension. This is not a replacement but an addendum :)


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


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.


You can find it on github

0 0
1 follower
Yii Version: 2.0
License: BSD-2-Clause
Category: Database
Developed by: Blizz
Created on: Nov 27, 2014
Last updated: 9 years ago

Related Extensions