src/POData/Providers/Metadata/SimpleMetadataProvider.php
/**
     * To add a complex property to entity or complex type
     * 
     * @param ResourceType $resourceType        The resource type to which the 
     *                                          complex property needs to add
     * @param string       $name                name of the complex property
     * @param ResourceType $complexResourceType complex resource type
     * @param Boolean      $isBag               complex type is bag or not
     * 
     * @return ResourceProperty
     */
To add a complex property to entity or complex type

@param ResourceType $resourceType        The resource type to which the
complex property needs to add
@param string       $name                name of the complex property
@param ResourceType $complexResourceType complex resource type
@param Boolean      $isBag               complex type is bag or not


To add a complex property to entity or complex type @param ResourceType $resourceType The resource type to which the complex property needs to add @param string $name name of the complex property @param ResourceType $complexResourceType complex resource type @param Boolean $isBag complex type is bag or not
public function addComplexProperty($resourceType, $name, $complexResourceType, $isBag = false)
    {
        if ($resourceType->getResourceTypeKind() != ResourceTypeKind::ENTITY 
            && $resourceType->getResourceTypeKind() != ResourceTypeKind::COMPLEX
        ) {
            throw new InvalidOperationException('complex property can be added to an entity or another complex type');
        }
        try 
        {
            $resourceType->getInstanceType()->getProperty($name);
        }
        catch (\ReflectionException $ex)
        {
            throw new InvalidOperationException('Can\'t add a property which does not exist on the instance type.');
        }
        $kind = ResourcePropertyKind::COMPLEX_TYPE;
        if ($isBag) {    	   
            $kind = $kind | ResourcePropertyKind::BAG;
        }
        $resourceProperty = new ResourceProperty($name, null, $kind, $complexResourceType);
        $resourceType->addProperty($resourceProperty);
        return $resourceProperty;
    }
public function addComplexProperty ( $ resourceType , $ name , $ complexResourceType , $ isBag = false ) { if ( $ resourceType -> getResourceTypeKind ( ) != ResourceTypeKind :: ENTITY && $ resourceType -> getResourceTypeKind ( ) != ResourceTypeKind :: COMPLEX ) { throw new InvalidOperationException ( 'complex property can be added to an entity or another complex type' ) ; } try { $ resourceType -> getInstanceType ( ) -> getProperty ( $ name ) ; } catch ( \ ReflectionException $ ex ) { throw new InvalidOperationException ( 'Can\'t add a property which does not exist on the instance type.' ) ; } $ kind = ResourcePropertyKind :: COMPLEX_TYPE ; if ( $ isBag ) { $ kind = $ kind | ResourcePropertyKind :: BAG ; } $ resourceProperty = new ResourceProperty ( $ name , null , $ kind , $ complexResourceType ) ; $ resourceType -> addProperty ( $ resourceProperty ) ; return $ resourceProperty ; }
To add a complex property to entity or complex type
To add a complex property to entity or complex type