LeanMapper\Reflection\Property::getCustomFlagValue PHP Method

getCustomFlagValue() public method

Gets value of requested custom flag
public getCustomFlagValue ( string $name ) : string
$name string
return string
    public function getCustomFlagValue($name)
    {
        if (!$this->hasCustomFlag($name)) {
            throw new InvalidArgumentException("Property '{$this->name}' in entity {$this->entityReflection->getName()} doesn't have custom flag '{$name}'.");
        }
        return $this->customFlags[$name];
    }

Usage Example

Ejemplo n.º 1
0
 private function getType(Property $property)
 {
     $type = NULL;
     if ($property->isBasicType()) {
         $type = $property->getType();
         if ($type == 'string') {
             if (!$property->hasCustomFlag('size')) {
                 $type = 'text';
             }
         }
         /* if ($property->containsEnumeration()) {
         	  $type = 'enum';
         	  } */
     } else {
         // Objects
         $class = new ReflectionClass($property->getType());
         $class = $class->newInstance();
         if ($class instanceof DateTime) {
             if ($property->hasCustomFlag('format')) {
                 $type = $property->getCustomFlagValue('format');
             } else {
                 $type = 'datetime';
             }
         }
     }
     return $type;
 }
All Usage Examples Of LeanMapper\Reflection\Property::getCustomFlagValue