ManyToManyLinkedLazy.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2005-2007 by Konstantin V. Arkhipov                     *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation; either version 3 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  ***************************************************************************/
00011 /* $Id: ManyToManyLinkedLazy.class.php 4687 2007-12-09 18:57:18Z voxus $ */
00012 
00016     final class ManyToManyLinkedLazy extends ManyToManyLinkedWorker
00017     {
00022         public function sync(&$insert, &$update = array(), &$delete)
00023         {
00024             Assert::isTrue($update === array());
00025             
00026             $dao = $this->container->getDao();
00027             
00028             $db = DBPool::getByDao($dao);
00029             
00030             if ($insert)
00031                 for ($i = 0, $size = count($insert); $i < $size; ++$i)
00032                     $db->queryNull($this->makeInsertQuery($insert[$i]));
00033 
00034             if ($delete) {
00035                 $db->queryNull($this->makeDeleteQuery($delete));
00036                 
00037                 $dao->uncacheByIds($delete);
00038             }
00039 
00040             return $this;
00041         }
00042         
00046         public function makeFetchQuery()
00047         {
00048             $uc = $this->container;
00049             
00050             return
00051                 $this->joinHelperTable(
00052                     $this->makeSelectQuery()->
00053                     dropFields()->
00054                     get(
00055                         new DBField(
00056                             $uc->getChildIdField(),
00057                             $uc->getHelperTable()
00058                         )
00059                     )
00060                 );
00061         }
00062     }
00063 ?>

Generated on Sun Dec 9 21:56:24 2007 for onPHP by  doxygen 1.5.4