/** * Set annotation to cast object. It need for get params specified in annotation * @param \Phalcon\Annotations\Annotation $anatation */ public function setData(\Phalcon\Annotations\Annotation $anatation) { $params = $anatation->getArguments(); if (isset($params[Reference::PARAM_PRECISION])) { $this->_precision = (int) $params[Reference::PARAM_PRECISION]; } }
/** * Set annotation to cast object. It need for get params specified in annotation * @param \Phalcon\Annotations\Annotation $anatation */ public function setData(\Phalcon\Annotations\Annotation $anatation) { $params = $anatation->getArguments(); if (isset($params[Reference::PARAM_TRIM])) { $this->_trim = filter_var($params[Reference::PARAM_TRIM], FILTER_VALIDATE_BOOLEAN); } if (isset($params[Reference::PARAM_UPPERCASE])) { $this->_uppercase = filter_var($params[Reference::PARAM_UPPERCASE], FILTER_VALIDATE_BOOLEAN); } if (isset($params[Reference::PARAM_LOWERCASE])) { $this->_lowercase = filter_var($params[Reference::PARAM_LOWERCASE], FILTER_VALIDATE_BOOLEAN); } }
public function buildRoute(Annotation $annotation, $method) { $path = $annotation->getArgument('path'); $result = []; if ($path) { $result['action'] = $this->getActionName($method); $result['path'] = $path; $result['method'] = $annotation->getArgument('method'); } else { Logger::getInstance()->warning("Annotation Route must have attribute path @Route(path=/uri)"); } return $result; }
public function __construct($property, \Phalcon\Annotations\Annotation $annotation) { $this->_property = $property; $params = $annotation->getArguments(); if (isset($params[Reference::ANNOTATION_PROPERTY_TYPE])) { if (stripos($params[Reference::ANNOTATION_PROPERTY_TYPE], '[]') !== false) { $this->_isArray = true; $params[Reference::ANNOTATION_PROPERTY_TYPE] = rtrim($params[Reference::ANNOTATION_PROPERTY_TYPE], '[]'); } $this->_type = $params[Reference::ANNOTATION_PROPERTY_TYPE]; } if (isset($params[Reference::ANNOTATION_PROPERTY])) { $this->_mappingProperty = $params[Reference::ANNOTATION_PROPERTY]; } else { $this->_mappingProperty = $property; } $this->_annotation = $annotation; }
/** * Maps annotations to collection object * * @throws Exception\CollectionArgumentNotFoundException */ public function mapCollectionWrapper() { foreach ($this->annotation->getArguments() as $argument => $value) { $this->collection->setArgument($argument, $value); } }