MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
attributemap.class
Ir para a documentação deste ficheiro.
1<?php
2
4{
5 private $columnMap = NULL;
6 private $name;
7 private $proxy;
8 private $reference;
9 private $index = NULL;
10
11 public function __construct($name)
12 {
13 $this->name = $name;
14 $this->columnMap = NULL;
15 }
16
17 public function setName($name)
18 {
19 $this->name = $name;
20 }
21
22 public function getName()
23 {
24 return $this->name;
25 }
26
27 public function setIndex($index)
28 {
29 $this->index = $index;
30 }
31
32 public function setValue($object, $value)
33 {
34 if (($pos = strpos($this->name, '.')) !== FALSE)
35 {
36 $nested = substr($this->name,0,$pos);
37 if (is_null($object->{$nested}))
38 {
39 $attribute = substr($this->name,$pos+1);
40 $classMap = $object->getClassMap();
41 $aMap = $classMap->getAssociationMap($nested);
42 $cm = $aMap->getForClass();
43 $nestedObject = $cm->getObject();
44 $object->{$nested} = $nestedObject;
45 }
46 else
47 {
48 $nestedObject = $object->{$nested};
49 }
50 $nestedObject->{$attribute} = $value;
51 }
52 elseif ($this->index)
53 {
54 $object->{$this->name}{$this->index} = $value;
55 }
56 else
57 {
58 $object->{$this->name} = $value;
59 }
60 }
61
62 public function getValue($object)
63 {
64 if ($this->index)
65 {
66 $value = $object->{$this->name}{$this->index};
67 }
68 else
69 {
70 $value = $object->{$this->name};
71 }
72 return $value;
73 }
74
75 public function setProxy($value=NULL)
76 {
77 if ($value === NULL) $value = false;
78 $this->proxy = ($value == 'true');
79 }
80
81 public function isProxy()
82 {
83 return $this->proxy;
84 }
85
86 public function setColumnMap(&$columnMap)
87 {
88 $this->columnMap = $columnMap;
89 }
90
91 public function setReference(&$attributeMap)
92 {
93 $this->reference = $attributeMap;
94 }
95
96 public function getReference()
97 {
98 return $this->reference;
99 }
100
101 public function getColumnMap()
102 {
103 return $this->columnMap;
104 }
105}
106?>
setProxy($value=NULL)
setReference(&$attributeMap)
__construct($name)
setColumnMap(&$columnMap)
getValue($object)
setIndex($index)
setValue($object, $value)