public static function get() { if (LocalDBClientBuilder::$client == null) { LocalDBClientBuilder::$client = DynamoDbClient::factory(array('region' => 'us-west-2', 'version' => 'latest', 'endpoint' => 'http://localhost:8000', 'key' => 'myKey', 'secret' => 'mySecret')); // AMO: TODO remove debug plugin //LocalDBClientBuilder::$client->addSubscriber(LogPlugin::getDebugPlugin()); } return LocalDBClientBuilder::$client; /* $sdk = new Aws\Sdk([ 'region' => 'us-west-2', 'version' => 'latest', 'endpoint' => 'http://localhost:8080' ]); $dynamodb = $sdk->createDynamoDb();*/ }
function getContentsChild($child) { $contentsFamilial = $child->getContentByType("family"); $contentsPedagogique = $child->getContentByType("teacher"); $contentsMedical = $child->getContentByType("doctor"); $reponse = array(); if (count($contentsMedical) > 0) { //$reponse[]= 'medical_'; foreach ($contentsMedical as $contentM) { //print_r($contentM); $owner = $contentM['M']['owner']['S']; $name = $contentM['M']['name']['S']; $contentDao = new ContentDAO(LocalDBClientBuilder::get()); $contents = $contentDao->getContentsOfUser($owner); foreach ($contents as $c) { $name2 = $c->getName(); //echo $name2.' =? '.$name; if ($name2 == $name) { $reponse[] = $name; $reponse[] = $c->getUrl(); } //echo $c->getUrl(); //echo 'temp '.$reponse; } //print_r($contents); } } if (count($contentsFamilial) > 0) { //$reponse[]= 'family_'; foreach ($contentsFamilial as $contentF) { $owner = $contentF['M']['owner']['S']; $name = $contentF['M']['name']['S']; $contentDao = new ContentDAO(LocalDBClientBuilder::get()); $contents = $contentDao->getContentsOfUser($owner); foreach ($contents as $c) { $name2 = $c->getName(); //echo $name2.' =? '.$name; if ($name2 == $name) { $reponse[] = $name; $reponse[] = $c->getUrl(); } //echo $c->getUrl(); //echo 'temp '.$reponse; } } } if (count($contentsPedagogique) > 0) { //$reponse[]= 'teaching_'; foreach ($contentsPedagogique as $contentP) { $owner = $contentP['M']['owner']['S']; $name = $contentP['M']['name']['S']; $contentDao = new ContentDAO(LocalDBClientBuilder::get()); $contents = $contentDao->getContentsOfUser($owner); foreach ($contents as $c) { $name2 = $c->getName(); //echo $name2.' =? '.$name; if ($name2 == $name) { $reponse[] = $name; $reponse[] = $c->getUrl(); } //echo $c->getUrl(); //echo 'temp '.$reponse; } } } //print_r($reponse); return $reponse; }