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());
 }
Exemple #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;
 }
 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);
 }