| @@ 951-971 (lines=21) @@ | ||
| 948 | * (2) http://www.php.net/manual/en/language.oop5.cloning.php |
|
| 949 | * (3) http://stackoverflow.com/questions/185934/how-do-i-create-a-copy-of-an-object-in-php |
|
| 950 | */ |
|
| 951 | public function __clone() |
|
| 952 | { |
|
| 953 | // if the entity has no identity do nothing, do NOT throw an exception |
|
| 954 | if (!($this->id)) { |
|
| 955 | return; |
|
| 956 | } |
|
| 957 | ||
| 958 | // otherwise proceed |
|
| 959 | ||
| 960 | // unset identifiers |
|
| 961 | $this->setId(0); |
|
| 962 | ||
| 963 | // reset workflow |
|
| 964 | $this->resetWorkflow(); |
|
| 965 | ||
| 966 | $this->setCreatedBy(null); |
|
| 967 | $this->setCreatedDate(null); |
|
| 968 | $this->setUpdatedBy(null); |
|
| 969 | $this->setUpdatedDate(null); |
|
| 970 | ||
| 971 | } |
|
| 972 | } |
|
| 973 | ||
| @@ 1162-1179 (lines=18) @@ | ||
| 1159 | * (2) http://www.php.net/manual/en/language.oop5.cloning.php |
|
| 1160 | * (3) http://stackoverflow.com/questions/185934/how-do-i-create-a-copy-of-an-object-in-php |
|
| 1161 | */ |
|
| 1162 | public function __clone() |
|
| 1163 | { |
|
| 1164 | // If the entity has an identity, proceed as normal. |
|
| 1165 | if ($this->id) { |
|
| 1166 | // unset identifiers |
|
| 1167 | $this->setId(0); |
|
| 1168 | ||
| 1169 | // reset Workflow |
|
| 1170 | $this->resetWorkflow(); |
|
| 1171 | ||
| 1172 | $this->setCreatedDate(null); |
|
| 1173 | $this->setCreatedUserId(null); |
|
| 1174 | $this->setUpdatedDate(null); |
|
| 1175 | $this->setUpdatedUserId(null); |
|
| 1176 | ||
| 1177 | } |
|
| 1178 | // otherwise do nothing, do NOT throw an exception! |
|
| 1179 | } |
|
| 1180 | } |
|
| 1181 | ||