Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00015 final class OneToManyLinkedFull extends OneToManyLinkedWorker
00016 {
00020 public function makeFetchQuery()
00021 {
00022 return $this->targetize($this->makeSelectQuery());
00023 }
00024
00028 public function sync($insert, $update = array(), $delete)
00029 {
00030 $uc = $this->container;
00031 $dao = $uc->getDao();
00032
00033 if ($delete) {
00034 DBPool::getByDao($dao)->queryNull(
00035 OSQL::delete()->from($dao->getTable())->
00036 where(
00037 Expression::eq(
00038 new DBField($uc->getParentIdField()),
00039 $uc->getParentObject()->getId()
00040 )
00041 )->
00042 andWhere(
00043 Expression::in(
00044 $uc->getChildIdField(),
00045 ArrayUtils::getIdsArray($delete)
00046 )
00047 )
00048 );
00049
00050 $dao->uncacheByIds(ArrayUtils::getIdsArray($delete));
00051 }
00052
00053 if ($insert)
00054 for ($i = 0, $size = count($insert); $i < $size; ++$i)
00055 $dao->add($insert[$i]);
00056
00057 if ($update)
00058 for ($i = 0, $size = count($update); $i < $size; ++$i)
00059 $dao->save($update[$i]);
00060
00061 return $this;
00062 }
00063 }
00064 ?>