Add a new class that aims at providing a simple gateway between stored
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 14 Oct 2010 15:40:36 +0000 (17:40 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 17 Oct 2010 19:51:35 +0000 (21:51 +0200)
commit26d00fe51bd4399ec2f9dff4a797daf2fc23961a
tree089458b1f0ca439fa9b779318bcd5275f135d93c
parente3c131627aa03f7107709e6d44c7840c09847acd
Add a new class that aims at providing a simple gateway between stored
data and php code when data are fetched 'as is'.

UseCase: classes like Phones or Addresses.

How to use:
 /* Fetching the content of a entry */
 $entry = new PlDBTableEntry('accounts', true /* autofetch */);
 $entry->uid = 26071;
 print $entry->hruid;

 /* Iterating on entries and saving changes*/
 $selector = new PlDBTableEntry('profile_phones');
 $selector->pid = 26071;
 $selector->link_type = 'pro';
 foreach ($selector as $entry) {
    $entry->comment = 'Professional phone number';
    $entry->save();
 }

Note: ATM, SQL joins are not supported, but this is planned for the
future with an API that might looks like:
  $entry = new PlDBTableEntry(array($mainTable,
                                    PlSqlJoin::left(),
                                    PlSqlJoin::inner()));

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/pldbtableentry.php [new file with mode: 0644]
classes/plflagset.php
include/misc.inc.php
include/platal.inc.php