This extension provides activeRecord support for amazon dynamo db
return [ //.... 'components' => [ ddb' => [ "class"=>'dnocode\awsddb\ar\Connection', 'base_url'=>"http://localhost:8000 [OPTIONAL ONLY FOR DYNAMO LOCAL]", 'key' => 'AMAZONKEY', 'secret' => 'AMAZONSECRET', 'region' => 'eu-west-1' ], ] ];
Add to composer dependencies
"dnocode/yii2-awsddb": "*"
How to define a model
class Element {
public $name;
public $surname;
public $sex;
public $uid;
/**hash and range**/
public static function primaryKey(){ return ["uid"];}
public function rules(){ return [[['uid'], 'required']];}
}
$e=new Element();
$e->name
$e->name="nerd";
$e->surname="iam";
$e->sex="no_nerd_i_said";
$e->uid="ciao";
$e->save();
$element=Element::find()->where(["uid"=>"ciao"]) ->one();
$element->surname="update";
$consumer->save();
$element=Element::find()->where(["uid"=>"ciao"]) ->one();
$element->delete();
Element::deleteAll(["uid"=>"ciao"]);
$element=Element::find()->
where(["surname"=>"iam"])
->one();
the active record will use
get operation 4 performance*/
```
$element=Element::find()->
andWhere("uid")
->eq("ciao")
->all();*/
```
will be execute a scan operation with filter on that attribute
```
$element=Element::find()->
andwhere("surname")->eq("prova")
->all();
```
```
$element=Element::orWhere("name")->in(["name1","name2"])
->all();
```
Activerecord dynamo db
Changed way to define attribute in activerecord Added support for new M value and L value
Comments