11.20
php
saved
jose_zap
Note
Lazy loading for model associations
Lazy loading for model associations
- function __get($assoc) {
- foreach ($this->__associations as $type) {
- parent::__constructLinkedModel($assoc, $this->{$type}[$assoc]['className']);
- }
- parent::__generateAssociation($type);
- }
- return $this->{$assoc};
- }
- function __isset($assoc) {
- return true;
- } else {
- //Try loading a model
- foreach ($this->__associations as $type) {
- parent::__constructLinkedModel($assoc, $this->{$type}[$assoc]['className']);
- }
- parent::__generateAssociation($type);
- }
- }
- }
- function __constructLinkedModel($assoc, $className = null) {
- foreach ($this->__associations as $type) {
- return;
- }
- }
- parent::__constructLinkedModel($assoc, $className);
- }
Parsed in 0.044 seconds, using GeSHi 1.0.7.14