LeanMapper\Reflection\Property::isBasicType PHP Method

isBasicType() public method

Tells whether property type is basic type (boolean|integer|float|string|array)
public isBasicType ( ) : boolean
return boolean
    public function isBasicType()
    {
        return $this->type->isBasicType();
    }

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::isBasicType