public function testMerge() { $left = new Object(['id' => 1, 'foo' => 'bar']); $right = new Object(['foo' => 'foo']); $result = Merger::merge($left, $right); $this->assertInstanceOf('PSX\\Data\\RecordInterface', $result); $this->assertEquals(['id' => 1, 'foo' => 'foo'], $result->getRecordInfo()->getData()); }
protected function doUpdate(RecordInterface $record, Version $version) { $table = $this->getTable(); $data = $table->get($record->getRecordInfo()->getField($table->getPrimaryKey())); if (empty($data)) { throw new StatusCode\NotFoundException('Record not found'); } $table->update(Merger::merge($data, $record)); return array('success' => true, 'message' => sprintf('%s successful updated', ucfirst($table->getDisplayName()))); }