00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00016 abstract class AbstractProtoClass extends Singleton
00017 {
00018 abstract protected function makePropertyList();
00019 abstract protected function makeForm();
00020
00021 final public function getPropertyList()
00022 {
00023 static $lists = array();
00024
00025 $className = get_class($this);
00026
00027 if (!isset($lists[$className])) {
00028 $lists[$className] = $this->makePropertyList();
00029 }
00030
00031 return $lists[$className];
00032 }
00033
00038 public function getPropertyByName($name)
00039 {
00040 $list = $this->getPropertyList();
00041
00042 if (isset($list[$name]))
00043 return $list[$name];
00044
00045 throw new MissingElementException(
00046 'unknown property requested by name '."'{$name}'"
00047 );
00048 }
00049
00050 public function getMapping()
00051 {
00052 $mapping = array();
00053
00054 foreach ($this->getPropertyList() as $name => $property) {
00055 if (
00056 !$property->getRelationId()
00057 || (
00058 $property->getRelationId()
00059 == MetaRelation::ONE_TO_ONE
00060 ) || (
00061 $property->getFetchStrategyId()
00062 == FetchStrategy::LAZY
00063 )
00064 ) {
00065 $mapping[$name] = $property->getColumnName();
00066 }
00067 }
00068
00069 return $mapping;
00070 }
00071 }
00072 ?>