DictionaryDaoBuilder.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2006-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: DictionaryDaoBuilder.class.php 4687 2007-12-09 18:57:18Z voxus $ */
00012 
00016     final class DictionaryDaoBuilder extends BaseBuilder
00017     {
00018         public static function build(MetaClass $class)
00019         {
00020             $out = self::getHead();
00021             
00022             $out .= <<<EOT
00023 abstract class Auto{$class->getName()}DAO extends ComplexBuilderDAO
00024 {
00025 
00026 EOT;
00027 
00028             $pointers = self::buildPointers($class);
00029             
00030             $className = $class->getName();
00031             $varName = strtolower($className[0]).substr($className, 1);
00032             
00033             $out .= <<<EOT
00034 {$pointers}
00035 
00036 EOT;
00037             if ($class->getPattern() instanceof AbstractClassPattern) {
00038                 if (
00039                     ($parent = $class->getParent())
00040                     && !($parent->getPattern() instanceof AbstractClassPattern)
00041                 ) {
00042                     $typeHint = $parent->getFinalParent()->getName();
00043                 } else {
00044                     $typeHint = '/* '.$class->getName().' */';
00045                 }
00046                 
00047                 $out .= <<<EOT
00048 
00052     public function setQueryFields(InsertOrUpdateQuery \$query, {$typeHint} \${$varName})
00053     {
00054 
00055 EOT;
00056             } else {
00057                 $out .= <<<EOT
00058 
00062     public function setQueryFields(InsertOrUpdateQuery \$query, {$className} \${$varName})
00063     {
00064 
00065 EOT;
00066             }
00067             
00068             $out .= self::buildFillers($class);
00069             
00070             return $out.self::getHeel();
00071         }
00072     }
00073 ?>

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