00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00016 final class PrimitiveArray extends FiltrablePrimitive
00017 {
00025 private $fetchMode = null;
00026
00030 public function setFetchMode($ternary)
00031 {
00032 Assert::isTernaryBase($ternary);
00033
00034 $this->fetchMode = $ternary;
00035
00036 return $this;
00037 }
00038
00039 public function import($scope)
00040 {
00041 if (!BasePrimitive::import($scope))
00042 return null;
00043
00044 $this->value = $scope[$this->name];
00045
00046 $this->selfFilter();
00047
00048 if (
00049 is_array($this->value)
00050 && !($this->min && count($this->value) < $this->min)
00051 && !($this->min && count($this->value) > $this->max)
00052 ) {
00053 return true;
00054 } else {
00055 $this->value = null;
00056 }
00057
00058 return false;
00059 }
00060
00061 public function importValue($value)
00062 {
00063 if ($value instanceof UnifiedContainer) {
00064 if (
00065 ($this->fetchMode !== null)
00066 && ($value->getParentObject()->getId())
00067 ) {
00068 if ($value->isLazy() === $this->fetchMode) {
00069 $value = $value->getList();
00070 } else {
00071 $className = get_class($value);
00072
00073 $containter = new $className(
00074 $value->getParentObject(),
00075 $this->fetchMode
00076 );
00077
00078 $value = $containter->getList();
00079 }
00080 } elseif (!$value->isFetched())
00081 return null;
00082 }
00083
00084 if (is_array($value))
00085 return $this->import(array($this->getName() => $value));
00086
00087 return false;
00088 }
00089 }
00090 ?>