src/Entity/Reflection/Property.php
private function _initType($definition)
    {
        if (isset(self::$typeAliases[$definition])) {
            $definition = self::$typeAliases[$definition];
        }

        if (self::isScalarType($definition)
            || in_array(
                $definition,
                [self::TYPE_ARRAY, self::TYPE_DATE, self::TYPE_DATETIME],
                true
            )
        ) {
            // Scalar, array, date, datetime

            $this->type = $definition;
        } elseif (class_exists(Convention::nameToClass($definition, Convention::ENTITY_MASK))) {
            // Entity

            $this->type = self::TYPE_ENTITY;
            $this->typeOption = $definition;
        } elseif (substr($definition, -2) === "[]") {
            // Collection

            $this->type = self::TYPE_COLLECTION;
            $this->typeOption = rtrim($definition, "[]");
        } else {
            throw new Exception\PropertyException(
                "Unsupported type '" . $definition . "'!"
            );
        }
    }
private function _initType($definition)
    {
        if (isset(self::$typeAliases[$definition])) {
            $definition = self::$typeAliases[$definition];
        }

        if (self::isScalarType($definition)
            || in_array(
                $definition,
                [self::TYPE_ARRAY, self::TYPE_DATE, self::TYPE_DATETIME],
                true
            )
        ) {
            // Scalar, array, date, datetime

            $this->type = $definition;
        } elseif (class_exists(Convention::nameToClass($definition, Convention::ENTITY_MASK))) {
            // Entity

            $this->type = self::TYPE_ENTITY;
            $this->typeOption = $definition;
        } elseif (substr($definition, -2) === "[]") {
            // Collection

            $this->type = self::TYPE_COLLECTION;
            $this->typeOption = rtrim($definition, "[]");
        } else {
            throw new Exception\PropertyException(
                "Unsupported type '" . $definition . "'!"
            );
        }
    }
private function _initType ( $ definition ) { if ( isset ( self :: $ typeAliases [ $ definition ] ) ) { $ definition = self :: $ typeAliases [ $ definition ] ; } if ( self :: isScalarType ( $ definition ) || in_array ( $ definition , [ self :: TYPE_ARRAY , self :: TYPE_DATE , self :: TYPE_DATETIME ] , true ) ) { // Scalar, array, date, datetime $ this -> type = $ definition ; } elseif ( class_exists ( Convention :: nameToClass ( $ definition , Convention :: ENTITY_MASK ) ) ) { // Entity $ this -> type = self :: TYPE_ENTITY ; $ this -> typeOption = $ definition ; } elseif ( substr ( $ definition , - 2 ) === "[]" ) { // Collection $ this -> type = self :: TYPE_COLLECTION ; $ this -> typeOption = rtrim ( $ definition , "[]" ) ; } else { throw new Exception \ PropertyException ( "Unsupported type '" . $ definition . "'!" ) ; } }
Initialize property type

@param string $definition

@return mixed

@throws Exception\PropertyException
Initialize property type