Esempio n. 1
0
 /**
  * Convert data into jsonpatch query and save it in the data source
  * @return mixed
  */
 public function persist()
 {
     $this->validate();
     if (!is_array($this->data)) {
         $this->data = [$this->data];
     }
     $append = $this instanceof StreamCollectorInterface;
     $patches = $this->jsonPatch->generateArrayAdd($this->getPath(), $this->data, $append);
     $this->dataSource->save($this->process, $patches);
     $this->data = [];
 }
Esempio n. 2
0
 public function testCompileInvalidTarget()
 {
     $jsonPatch = new JsonPatch();
     $patch = $jsonPatch->generate('aa', JsonPatch::ACTION_REMOVE, 'dummy');
     $jsonPatch->compile([json_encode($patch)]);
 }