Indefero

Indefero Commit Details


Date:2011-01-23 10:12:19 (13 years 10 months ago)
Author:Loïc d'Anterroches
Branch:develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:390c9b50484f526fbcf354bd44fe57a6ff35cd0e
Parents: 58804923ef61cc9defb71fb2c19475e7375210a8
Message:Added to collect associated data for the commits in one SQL query.

Changes:

File differences

src/IDF/Commit.php
127127
128128
129129
130
130131
131132
132133
{
IDF_Timeline::remove($this);
IDF_Search::remove($this);
IDF_Gconf::dropForModel($this);
}
/**
src/IDF/Gconf.php
154154
155155
156156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
157183
158184
159185
}
/**
* Collection selection.
*
* Suppose you have 5 objects with associated meta data in the
* Gconf storage, if you load the data independently for each
* object, you end up with 5 SELECT queries. With 25 objects, 25
* SELECT. You can select with one query all the data and merge in
* the code. It is faster. The collection selection get a
* model_class and a list of ids and returns an id indexed array
* of associative array data. This is for read only access as you
* do not get a series of Gconf objects.
*/
public static function collect($class, $ids)
{
$gconf = new IDF_Gconf();
$stmpl = sprintf('model_class=%%s AND model_id IN (%s)',
implode(',' , $ids));
$sql = new Pluf_SQL($stmpl, array($class));
$out = array_fill_keys($ids, array());
foreach ($gconf->getList(array('filter' => $sql->gen())) as $c) {
$out[$c->model_id][$c->vkey] = $c->vdesc;
}
return $out;
}
/**
* Drop the conf of a model.
*
* If your model is using this table, just add the following line

Archive Download the corresponding diff file

Page rendered in 0.08489s using 13 queries.