/** * * @param $value string * @param $reflection_property Reflection_Property */ public function __construct($value, Reflection_Property $reflection_property) { parent::__construct($value, $reflection_property); if (!$this->value) { $types = $reflection_property->getDeclaringClass()->getDefaultProperties(); $this->value = gettype($types[$reflection_property->getName()]); } }
/** * @param $value string * @param $property Reflection_Property */ public function __construct($value, Reflection_Property $property) { parent::__construct($value, $property); if (empty($this->value)) { $link = $property->getAnnotation('link')->value; $possibles = null; if ($link == Link_Annotation::COLLECTION) { $possibles = $this->defaultCollection($property); } elseif ($link == Link_Annotation::MAP) { $possibles = $this->defaultMap($property); } elseif ($link == Link_Annotation::OBJECT) { $possibles = $this->defaultObject($property); } if (is_array($possibles) && count($possibles) == 1) { $this->value = reset($possibles); } } }
/** * @param $value string * @param $property Reflection_Property */ public function __construct($value, Reflection_Property $property) { parent::__construct($value, $property); if (empty($this->value)) { $link = $property->getAnnotation('link')->value; $possibles = null; if ($link === Link_Annotation::COLLECTION) { $possibles = $this->defaultCollection($property); } elseif ($link === Link_Annotation::MAP) { $possibles = $this->defaultMap($property); } elseif ($link === Link_Annotation::OBJECT) { $possibles = $this->defaultObject($property); } if (is_array($possibles) && count($possibles) == 1) { $this->value = reset($possibles); } elseif (count($possibles) > 1) { $class_name = $property->getDeclaringClassName(); $property_name = $property->getName(); $type_name = $property->getType()->getElementTypeAsString(); trigger_error('Can\'t guess @foreign for ' . $class_name . '::' . $property_name . ' : ' . 'please set @composite on one (and one only) ' . $type_name . ' property of type ' . $class_name . ' object, or force the ' . $class_name . '::' . $property_name . ' @foreign property name. Possibles properties are ' . join(', ', $possibles), E_USER_ERROR); } } }