[Solar-svn] Revision 3123
pmjones at solarphp.com
pmjones at solarphp.com
Tue Apr 15 08:09:18 CDT 2008
Solar_Sql_Model_Record
* [CHG] Now that Solar_Filter only loops through filter keys, not every single data key regardless of whether or not it has filters on it, the lazy-load flag is no longer needed.
* [ADD] Method load() now adds placeholders for calculate-cols.
Modified: trunk/Solar/Sql/Model/Record.php
===================================================================
--- trunk/Solar/Sql/Model/Record.php 2008-04-15 01:46:22 UTC (rev 3122)
+++ trunk/Solar/Sql/Model/Record.php 2008-04-15 13:09:12 UTC (rev 3123)
@@ -93,17 +93,6 @@
/**
*
- * Tells whether or not __get() should lazy-load relateds.
- *
- * We need this so that when saving, we don't load every related record.
- *
- * @var bool
- *
- */
- protected $_lazy_load = true;
-
- /**
- *
* If you call save() and an exception gets thrown, this stores that
* exception.
*
@@ -150,8 +139,7 @@
$this->_checkDeleted();
// do we need to load relationship data?
- $load_related = $this->_lazy_load &&
- empty($this->_data[$key]) &&
+ $load_related = empty($this->_data[$key]) &&
! empty($this->_model->related[$key]);
if ($load_related) {
@@ -378,11 +366,17 @@
unset($load[$name]);
}
+ // set placeholders for calculate cols
+ foreach ((array) $this->_model->calculate_cols as $col) {
+ if (! array_key_exists($col, $this->_data)) {
+ $this->_data[$col] = null;
+ }
+ }
+
// set all remaining values in the load
foreach ($load as $key => $val) {
$this->__set($key, $val);
}
-
}
// -----------------------------------------------------------------
@@ -1038,11 +1032,8 @@
// tell the filter to use the model for locale strings
$filter->setChainLocaleObject($this->_model);
- // turn off lazy-loading while applying filters to make sure we don't
- // get recursive behavior
- $this->_lazy_load = false;
+ // apply filters
$valid = $filter->applyChain($this);
- $this->_lazy_load = true;
// retain invalids
$invalid = $filter->getChainInvalid();
More information about the Solar-svn
mailing list