PlDBTableEntry: add support for custom selection.
Selection based on a non-primary key is now possible.
$user = new PlDBTableEntry('accounts');
$user->uid = 26071;
$user->fetch(); /* selection on primary key */
$user = new PlDBTableEntry('accounts');
$user->hruid = 'florent.bruneau.2003';
$user->fetch(); /* selection on non-primary unique key */
This also works for multiple keys in case of iteration
$selector = new PlDBTableEntry('accounts');
$selector->type = 'ax';
foreach ($selector as $user) {
$user->comment = 'AX secretary';
$user->update();
}
PlDBTableEntry now expose iterateOnCondition that takes a custom condition
for the entry selection.
$selector = new PlDBTableEntry('accounts');
$it = $selector->iterateOnCondition('FIND_IN_SET(\'watch\', flags');
while ($user = $it->next()) {
$user->comment = 'Watched account';
$user->update();
}
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>