コード例 #1
0
ファイル: ObjectMetadata.php プロジェクト: raptorlab/veloci
 public function addProperty(PropertyMetadata $property)
 {
     $this->properties[$property->getName()] = $property;
 }
コード例 #2
0
 private function setReturnTypeInfo(PropertyMetadata $propertyInfo, ReflectionMethod $method)
 {
     $returnType = $method->getReturnType();
     $docComment = $method->getDocComment();
     if ($returnType) {
         $propertyInfo->setType((string) $returnType);
         $propertyInfo->setNullable($returnType->allowsNull());
         $propertyInfo->setBuiltIn($returnType->isBuiltin());
     } else {
         $returnType = $this->parseReturnTypeDocBlock($docComment);
         $propertyInfo->setType($returnType);
         $propertyInfo->setNullable(true);
         $propertyInfo->setBuiltIn(false);
     }
     $domainInfo = $this->parseDomainTypeDocBlock($docComment);
     $domain = $this->domainResolver->resolveDomain($propertyInfo->getType(), $domainInfo);
     if ($domain) {
         $propertyInfo->setDomain($domain);
     }
     if (is_a($propertyInfo->getType(), EntityModel::class, true)) {
         $propertyInfo->setReference(true);
     }
 }
コード例 #3
0
 private function addIntegerRule(PropertyMetadata $property, array &$rules)
 {
     if ($property->getType() === 'int') {
         $rules[] = new IntegerRule();
     }
 }