Ejemplo n.º 1
0
 public function testSerializations()
 {
     $rec = new Record();
     $rec->key = 'value';
     $this->assertEquals(array('key' => 'value'), $rec->toArray());
     $this->assertJsonStringEqualsJsonString(json_encode(array('key' => 'value')), $rec->toJson());
 }
Ejemplo n.º 2
0
 /**
  * /
  * @param Record $record [description]
  */
 public function addTranslation(Record $record)
 {
     $fields = $record->getFieldsList();
     $values = $record->getInsertValueString();
     $sql = "INSERT INTO translations {$fields}, created VALUES {$values}, NOW()";
     $result = $this->db->run($sql, $record->toArray());
     return $result;
 }
Ejemplo n.º 3
0
 public function storeRecord(Record $item, $lifetime = null)
 {
     if (!$item->id) {
         $item->save();
     }
     $class = $item->getQualifiedClassname();
     $key = $this->_buildItemKey($class, $item->id);
     $this->_cacher->writeData($key, $item->toArray(), $lifetime);
 }