AutoDaoBuilder.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2006-2008 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 
00015     final class AutoDaoBuilder extends BaseBuilder
00016     {
00017         public static function build(MetaClass $class)
00018         {
00019             if (!$class->hasBuildableParent())
00020                 return DictionaryDaoBuilder::build($class);
00021             else
00022                 $parent = $class->getParent();
00023             
00024             if (
00025                 $class->getParent()->getPattern()
00026                     instanceof InternalClassPattern
00027             ) {
00028                 $parentName = 'StorableDAO';
00029             } else {
00030                 $parentName = $parent->getName().'DAO';
00031             }
00032             
00033             $out = self::getHead();
00034             
00035             $out .= <<<EOT
00036 abstract class Auto{$class->getName()}DAO extends {$parentName}
00037 {
00038 
00039 EOT;
00040 
00041             $out .= self::buildPointers($class)."\n}\n";
00042             
00043             return $out.self::getHeel();
00044         }
00045     }
00046 ?>