1: <?php
2:
3: namespace PHPixie\ORM;
4:
5: class Data {
6: 7: 8:
9: protected $documentBuilder;
10:
11: public function diff($set)
12: {
13: return new \PHPixie\ORM\Data\Diff($set);
14: }
15:
16: public function removingDiff($set, $unset)
17: {
18: return new \PHPixie\ORM\Data\Diff\Removing($set, $unset);
19: }
20:
21: public function map($data = null)
22: {
23: return new \PHPixie\ORM\Data\Types\Map($this, $data);
24: }
25:
26: public function document($documentNode)
27: {
28: return new \PHPixie\ORM\Data\Types\Document($documentNode);
29: }
30:
31: public function diffableDocument($documentNode)
32: {
33: return new \PHPixie\ORM\Data\Types\Document\Diffable($this, $documentNode);
34: }
35:
36: public function documentFromData($data = null)
37: {
38: $document = $this->documentBuilder()->document($data);
39: return $this->document($document);
40: }
41:
42: public function diffableDocumentFromData($data = null)
43: {
44: $document = $this->documentBuilder()->document($data);
45: return $this->diffableDocument($document);
46: }
47:
48: protected function documentBuilder()
49: {
50: if ($this->documentBuilder === null) {
51: $this->documentBuilder = $this->buildDocumentBuilder();
52: }
53:
54: return $this->documentBuilder;
55: }
56:
57: protected function buildDocumentBuilder()
58: {
59: return new \PHPixie\ORM\Data\Types\Document\Builder();
60: }
61: }