Changeset 248
- Timestamp:
- 11/01/07 21:46:56 (1 year ago)
- Files:
-
- trunk/api/Pluf/Model.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/api/Pluf/Model.php
r246 r248 308 308 function __get($prop) 309 309 { 310 if (isset($this->$prop)) return $this->$prop; 311 if (isset($this->_data[$prop])) return $this->_data[$prop]; 310 if (isset($this->$prop)){ 311 return $this->$prop; 312 } 313 if (isset($this->_data[$prop])) { 314 return $this->_data[$prop]; 315 } 312 316 else try { 313 317 return $this->__call($prop, array()); … … 366 370 Pluf::loadFunction($this->_methods_extra[$method][1]); 367 371 return call_user_func_array($this->_methods_extra[$method][1], $args); 372 } 373 374 // Getter 375 $prop = strtolower(substr($method, 3)); 376 if (substr($method, 0, 3) === "get") { 377 if (isset($this->$prop)){ 378 return $this->$prop; 379 } 380 if (isset($this->_data[$prop])) { 381 return $this->_data[$prop]; 382 } 383 } 384 385 // Setter 386 $val = $args[0]; 387 if (substr($method, 0, 3) === "set") { 388 if (isset($this->$prop)) { 389 $this->$prop = $val; 390 return; 391 } 392 elseif (isset($this->_fk[$prop])) { 393 $this->_data[$prop] = $val->id; 394 return; 395 } 396 elseif (isset($this->_cols[$prop])) { 397 $this->_data[$prop] = $val; 398 return; 399 } 368 400 } 369 401 throw new Exception(sprintf('Method "%s" not available', $method));
