2017 © Pedro Peláez
 

yii2-extension yii2-awsddb

Amazon dynamo db ActiveRecord for the Yii framework

image

dnocode/yii2-awsddb

Amazon dynamo db ActiveRecord for the Yii framework

  • Sunday, January 25, 2015
  • by dnocode
  • Repository
  • 3 Watchers
  • 3 Stars
  • 110 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 3 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Amazon Dynamodb activeRecord Yii 2

This extension provides activeRecord support for amazon dynamo db, (*1)

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' ], ] ];, (*2)

Installation

Add to composer dependencies, (*3)

"dnocode/yii2-awsddb": "*", (*4)

USING

How to define a model, (*5)

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']];}
}

put

$e=new Element();
$e->name
$e->name="nerd";
$e->surname="iam";
$e->sex="no_nerd_i_said";
$e->uid="ciao";
$e->save();

find and update

 $element=Element::find()->where(["uid"=>"ciao"])  ->one();
 $element->surname="update";
 $consumer->save();

delete and update

 $element=Element::find()->where(["uid"=>"ciao"])  ->one();
 $element->delete();
 Element::deleteAll(["uid"=>"ciao"]);

find with where

  $element=Element::find()->
          where(["surname"=>"iam"])
          ->one();

## Find object with the hash key the active record will use get operation 4 performance*/, (*6)

```
$element=Element::find()->
        andWhere("uid")
        ->eq("ciao")
        ->all();*/
 ```

## Execute find on attribute that isn`t primary key will be execute a scan operation with filter on that attribute, (*7)

```
$element=Element::find()->
        andwhere("surname")->eq("prova")
        ->all();
```

## Compare attribute with more than one value $element=Element::orWhere("name")->in(["name1","name2"]) ->all();, (*8)

TODO

  1. batch operations with transaction
  2. support for relation
  3. iterator for query with more than 1MB

The Versions

25/01 2015

dev-master

9999999-dev

Amazon dynamo db ActiveRecord for the Yii framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Dino Ricceri

yii2 amazon activerecord dynamo db

08/01 2015

v1.0.2

1.0.2.0

Amazon dynamo db ActiveRecord for the Yii framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Dino Ricceri

yii2 amazon activerecord dynamo db

30/12 2014

v1.0.1

1.0.1.0

Amazon dynamo db ActiveRecord for the Yii framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Dino Ricceri

yii2 amazon activerecord dynamo db