/**
  * Description of our service
  *
  * @return IMetadataProvider
  */
 public static function create()
 {
     $metadata = new SimpleMetadataProvider('Data', self::MetaNamespace);
     $metadata->addResourceSet('Products', self::createProductEntityType($metadata));
     $documentsEntityType = self::createDocumentEntityType($metadata);
     $documentsResourceSet = $metadata->addResourceSet('Documents', $documentsEntityType);
     $metadata->addResourceSet('Currencies', self::createCurrencyEntityType($metadata));
     $documentProductsEntityType = self::createDocumentProductEntityType($metadata);
     $documentProductsResourceSet = $metadata->addResourceSet('DocumentProducts', $documentProductsEntityType);
     $metadata->addResourceSetReferenceProperty($documentsEntityType, 'DocumentProducts', $documentProductsResourceSet);
     $metadata->addResourceReferenceProperty($documentProductsEntityType, 'Document', $documentsResourceSet);
     return $metadata;
 }
示例#2
0
 /**
  * create metadata
  * 
  * @throws InvalidOperationException
  * 
  * @return NorthWindMetadata
  */
 public static function create()
 {
     $metadata = new SimpleMetadataProvider('WordPressEntities', 'WordPress');
     //Register the entity (resource) type 'Post'
     $postsEntityType = $metadata->addEntityType(new ReflectionClass('Post'), 'Post', 'WordPress');
     $metadata->addKeyProperty($postsEntityType, 'PostID', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($postsEntityType, 'Author', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($postsEntityType, 'Date', EdmPrimitiveType::DATETIME);
     $metadata->addPrimitiveProperty($postsEntityType, 'DateGmt', EdmPrimitiveType::DATETIME);
     $metadata->addPrimitiveProperty($postsEntityType, 'Content', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($postsEntityType, 'Title', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($postsEntityType, 'Excerpt', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($postsEntityType, 'Status', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($postsEntityType, 'CommentStatus', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($postsEntityType, 'PingStatus', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($postsEntityType, 'Password', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($postsEntityType, 'Name', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($postsEntityType, 'ToPing', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($postsEntityType, 'Pinged', EdmPrimitiveType::STRING);
     $metadata->addETagProperty($postsEntityType, 'Modified', EdmPrimitiveType::DATETIME);
     $metadata->addPrimitiveProperty($postsEntityType, 'ModifiedGmt', EdmPrimitiveType::DATETIME);
     $metadata->addPrimitiveProperty($postsEntityType, 'ContentFiltered', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($postsEntityType, 'ParentID', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($postsEntityType, 'Guid', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($postsEntityType, 'MenuOrder', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($postsEntityType, 'Type', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($postsEntityType, 'MimeType', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($postsEntityType, 'CommentCount', EdmPrimitiveType::INT32);
     //Register the entity (resource) type 'Tag'
     $tagsEntityType = $metadata->addEntityType(new ReflectionClass('Tag'), 'Tag', 'WordPress');
     $metadata->addKeyProperty($tagsEntityType, 'TagID', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($tagsEntityType, 'Name', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($tagsEntityType, 'Slug', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($tagsEntityType, 'Description', EdmPrimitiveType::STRING);
     //Register the entity (resource) type 'Category'
     $catsEntityType = $metadata->addEntityType(new ReflectionClass('Category'), 'Category', 'WordPress');
     $metadata->addKeyProperty($catsEntityType, 'CategoryID', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($catsEntityType, 'Name', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($catsEntityType, 'Slug', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($catsEntityType, 'Description', EdmPrimitiveType::STRING);
     //Register the entity (resource) type 'Comment'
     $commentsEntityType = $metadata->addEntityType(new ReflectionClass('Comment'), 'Comment', 'WordPress');
     $metadata->addKeyProperty($commentsEntityType, 'CommentID', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($commentsEntityType, 'PostID', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($commentsEntityType, 'Author', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($commentsEntityType, 'AuthorEmail', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($commentsEntityType, 'AuthorUrl', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($commentsEntityType, 'AuthorIp', EdmPrimitiveType::STRING);
     $metadata->addETagProperty($commentsEntityType, 'Date', EdmPrimitiveType::DATETIME);
     $metadata->addPrimitiveProperty($commentsEntityType, 'DateGmt', EdmPrimitiveType::DATETIME);
     $metadata->addPrimitiveProperty($commentsEntityType, 'Content', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($commentsEntityType, 'Karma', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($commentsEntityType, 'Approved', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($commentsEntityType, 'Agent', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($commentsEntityType, 'Type', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($commentsEntityType, 'ParentID', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($commentsEntityType, 'UserID', EdmPrimitiveType::INT32);
     //Register the entity (resource) type 'User'
     $usersEntityType = $metadata->addEntityType(new ReflectionClass('User'), 'User', 'WordPress');
     $metadata->addKeyProperty($usersEntityType, 'UserID', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($usersEntityType, 'Login', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($usersEntityType, 'Nicename', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($usersEntityType, 'Email', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($usersEntityType, 'Url', EdmPrimitiveType::STRING);
     $metadata->addETagProperty($usersEntityType, 'Registered', EdmPrimitiveType::DATETIME);
     $metadata->addPrimitiveProperty($usersEntityType, 'Status', EdmPrimitiveType::INT16);
     $metadata->addPrimitiveProperty($usersEntityType, 'DisplayName', EdmPrimitiveType::STRING);
     $postsResourceSet = $metadata->addResourceSet('Posts', $postsEntityType);
     $tagsResourceSet = $metadata->addResourceSet('Tags', $tagsEntityType);
     $catsResourceSet = $metadata->addResourceSet('Categories', $catsEntityType);
     $commentsResourceSet = $metadata->addResourceSet('Comments', $commentsEntityType);
     $usersResourceSet = $metadata->addResourceSet('Users', $usersEntityType);
     //associations of Post
     $metadata->addResourceReferenceProperty($postsEntityType, 'User', $usersResourceSet);
     $metadata->addResourceSetReferenceProperty($postsEntityType, 'Tags', $tagsResourceSet);
     $metadata->addResourceSetReferenceProperty($postsEntityType, 'Categories', $catsResourceSet);
     $metadata->addResourceSetReferenceProperty($postsEntityType, 'Comments', $commentsResourceSet);
     //associations of Tag
     $metadata->addResourceSetReferenceProperty($tagsEntityType, 'Posts', $postsResourceSet);
     //associations of Category
     $metadata->addResourceSetReferenceProperty($catsEntityType, 'Posts', $postsResourceSet);
     //associations of Comment
     $metadata->addResourceReferenceProperty($commentsEntityType, 'User', $usersResourceSet);
     $metadata->addResourceReferenceProperty($commentsEntityType, 'Post', $postsResourceSet);
     //associations of User
     $metadata->addResourceSetReferenceProperty($usersEntityType, 'Posts', $postsResourceSet);
     $metadata->addResourceSetReferenceProperty($usersEntityType, 'Comments', $commentsResourceSet);
     return $metadata;
 }
示例#3
0
 /**
  * create metadata
  * 
  * @throws InvalidOperationException
  * 
  * @return NorthWindMetadata
  */
 public static function create()
 {
     $metadata = new SimpleMetadataProvider('NorthWindEntities', 'NorthWind');
     //Register the complex type 'Address' having a property of same type.
     $addressComplexType = $metadata->addComplexType(new ReflectionClass('Address'), 'Address', 'NorthWind', null);
     $metadata->addPrimitiveProperty($addressComplexType, 'StreetName', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($addressComplexType, 'City', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($addressComplexType, 'Region', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($addressComplexType, 'PostalCode', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($addressComplexType, 'Country', EdmPrimitiveType::STRING);
     //A complex sub property to hold alternate address
     $metadata->addComplexProperty($addressComplexType, 'AltAddress', $addressComplexType);
     //Register the entity (resource) type 'Customer'
     $customersEntityType = $metadata->addEntityType(new ReflectionClass('Customer'), 'Customer', 'NorthWind');
     $metadata->addKeyProperty($customersEntityType, 'CustomerID', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($customersEntityType, 'CompanyName', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($customersEntityType, 'ContactName', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($customersEntityType, 'ContactTitle', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($customersEntityType, 'Phone', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($customersEntityType, 'Fax', EdmPrimitiveType::STRING);
     $metadata->addComplexProperty($customersEntityType, 'Address', $addressComplexType);
     //Add a bag property (bag of complex type) to hold array of other addresses
     $metadata->addComplexProperty($customersEntityType, 'OtherAddresses', $addressComplexType, true);
     //Add a bag property (bag of primitve type) to hold array of email addresses
     $metadata->addPrimitiveProperty($customersEntityType, 'EmailAddresses', EdmPrimitiveType::STRING, true);
     //Register the entity (resource) type 'Order'
     $orderEntityType = $metadata->addEntityType(new ReflectionClass('Order'), 'Order', 'NorthWind');
     $metadata->addKeyProperty($orderEntityType, 'OrderID', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($orderEntityType, 'CustomerID', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($orderEntityType, 'EmployeeID', EdmPrimitiveType::INT32);
     //Adding an etag property
     $metadata->addETagProperty($orderEntityType, 'OrderDate', EdmPrimitiveType::DATETIME);
     $metadata->addPrimitiveProperty($orderEntityType, 'RequiredDate', EdmPrimitiveType::DATETIME);
     $metadata->addPrimitiveProperty($orderEntityType, 'ShippedDate', EdmPrimitiveType::DATETIME);
     $metadata->addPrimitiveProperty($orderEntityType, 'ShipVia', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($orderEntityType, 'Freight', EdmPrimitiveType::DECIMAL);
     $metadata->addPrimitiveProperty($orderEntityType, 'ShipName', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($orderEntityType, 'ShipAddress', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($orderEntityType, 'ShipCity', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($orderEntityType, 'ShipRegion', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($orderEntityType, 'ShipPostalCode', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($orderEntityType, 'ShipCountry', EdmPrimitiveType::STRING);
     //Register the entity (resource) type 'Order_Details'
     $orderDetailsEntityType = $metadata->addEntityType(new ReflectionClass('Order_Details'), 'Order_Details', 'NorthWind');
     $metadata->addKeyProperty($orderDetailsEntityType, 'ProductID', EdmPrimitiveType::INT32);
     $metadata->addKeyProperty($orderDetailsEntityType, 'OrderID', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($orderDetailsEntityType, 'UnitPrice', EdmPrimitiveType::DECIMAL);
     $metadata->addPrimitiveProperty($orderDetailsEntityType, 'Quantity', EdmPrimitiveType::INT16);
     $metadata->addPrimitiveProperty($orderDetailsEntityType, 'Discount', EdmPrimitiveType::SINGLE);
     //Register the entity (resource) type 'Employee'
     $employeeEntityType = $metadata->addEntityType(new ReflectionClass('Employee'), 'Employee', 'NorthWind');
     $metadata->addKeyProperty($employeeEntityType, 'EmployeeID', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($employeeEntityType, 'FirstName', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'LastName', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'Title', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'TitleOfCourtesy', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'BirthDate', EdmPrimitiveType::DATETIME);
     $metadata->addPrimitiveProperty($employeeEntityType, 'HireDate', EdmPrimitiveType::DATETIME);
     $metadata->addPrimitiveProperty($employeeEntityType, 'Address', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'City', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'Region', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'PostalCode', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'Country', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'HomePhone', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'Extension', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'Notes', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'ReportsTo', EdmPrimitiveType::INT32);
     //$metadata->addPrimitiveProperty($employeeEntityType, 'Photo', EdmPrimitiveType::BINARY);
     $metadata->addPrimitiveProperty($employeeEntityType, 'Emails', EdmPrimitiveType::STRING, true);
     $metadata->addPrimitiveProperty($employeeEntityType, 'PhotoPath', EdmPrimitiveType::STRING);
     //Set Employee entity type as MLE thus the url http://host/NorthWind.svc/Employee(1875)/$value will give the stream associated with employee with id 1875
     $employeeEntityType->setMediaLinkEntry(true);
     //Add a named stream property to the employee entity type
     //so the url http://host/NorthWind.svc/Employee(9831)/TumbNail_48X48 will give stream associated with employee's thumbnail (of size 48 x 48) image
     //$streamInfo = new ResourceStreamInfo('TumbNail_48X48');
     //$employeeEntityType->addNamedStream($streamInfo);
     $customersResourceSet = $metadata->addResourceSet('Customers', $customersEntityType);
     $ordersResourceSet = $metadata->addResourceSet('Orders', $orderEntityType);
     $orderDetialsResourceSet = $metadata->addResourceSet('Order_Details', $orderDetailsEntityType);
     $employeeResourceSet = $metadata->addResourceSet('Employees', $employeeEntityType);
     //Register the assoications (navigations)
     //Customers (1) <==> Orders (0-*)
     $metadata->addResourceSetReferenceProperty($customersEntityType, 'Orders', $ordersResourceSet);
     $metadata->addResourceReferenceProperty($orderEntityType, 'Customer', $customersResourceSet);
     //Register the assoications (navigations)
     //Orders (1) <==> Orders_Details (0-*)
     $metadata->addResourceReferenceProperty($orderDetailsEntityType, 'Order', $ordersResourceSet);
     $metadata->addResourceSetReferenceProperty($orderEntityType, 'Order_Details', $orderDetialsResourceSet);
     return $metadata;
 }
示例#4
0
 /**
  * 
  * 
  * @throws InvalidOperationException
  * @return IMetadataProvider
  */
 public static function Create()
 {
     $metadata = new SimpleMetadataProvider('NorthWindEntities', 'NorthWind');
     //Register the complex type 'Address2'
     $address2ComplexType = $metadata->addComplexType(new \ReflectionClass('UnitTests\\POData\\Facets\\NorthWind1\\Address2'), 'Address2');
     $metadata->addPrimitiveProperty($address2ComplexType, 'IsPrimary', EdmPrimitiveType::BOOLEAN);
     //Register the complex type 'Address' with 'Address2' as base class
     $addressComplexType = $metadata->addComplexType(new \ReflectionClass('UnitTests\\POData\\Facets\\NorthWind1\\Address4'), 'Address');
     $metadata->addPrimitiveProperty($addressComplexType, 'HouseNumber', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($addressComplexType, 'LineNumber', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($addressComplexType, 'LineNumber2', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($addressComplexType, 'StreetName', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($addressComplexType, 'IsValid', EdmPrimitiveType::BOOLEAN);
     $metadata->addComplexProperty($addressComplexType, 'Address2', $address2ComplexType);
     //Register the entity (resource) type 'Customer'
     $customersEntityType = $metadata->addEntityType(new \ReflectionClass('UnitTests\\POData\\Facets\\NorthWind1\\Customer2'), 'Customer');
     $metadata->addKeyProperty($customersEntityType, 'CustomerID', EdmPrimitiveType::STRING);
     $metadata->addKeyProperty($customersEntityType, 'CustomerGuid', EdmPrimitiveType::GUID);
     $metadata->addPrimitiveProperty($customersEntityType, 'CustomerName', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($customersEntityType, 'Country', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($customersEntityType, 'Rating', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($customersEntityType, 'Photo', EdmPrimitiveType::BINARY);
     $metadata->addComplexProperty($customersEntityType, 'Address', $addressComplexType);
     //Register the entity (resource) type 'Order'
     $orderEntityType = $metadata->addEntityType(new \ReflectionClass('UnitTests\\POData\\Facets\\NorthWind1\\Order2'), 'Order');
     $metadata->addKeyProperty($orderEntityType, 'OrderID', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($orderEntityType, 'OrderDate', EdmPrimitiveType::DATETIME);
     $metadata->addPrimitiveProperty($orderEntityType, 'DeliveryDate', EdmPrimitiveType::DATETIME);
     $metadata->addPrimitiveProperty($orderEntityType, 'ShipName', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($orderEntityType, 'ItemCount', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($orderEntityType, 'QualityRate', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($orderEntityType, 'Price', EdmPrimitiveType::DOUBLE);
     //Register the entity (resource) type 'Product2'
     $productEntityType = $metadata->addEntityType(new \ReflectionClass('UnitTests\\POData\\Facets\\NorthWind1\\Product2'), 'Product');
     $metadata->addKeyProperty($productEntityType, 'ProductID', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($productEntityType, 'ProductName', EdmPrimitiveType::STRING);
     //Register the entity (resource) type 'Order_Details'
     $orderDetailsEntityType = $metadata->addEntityType(new \ReflectionClass('UnitTests\\POData\\Facets\\NorthWind1\\Order_Details2'), 'Order_Details');
     $metadata->addKeyProperty($orderDetailsEntityType, 'ProductID', EdmPrimitiveType::INT32);
     $metadata->addKeyProperty($orderDetailsEntityType, 'OrderID', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($orderDetailsEntityType, 'UnitPrice', EdmPrimitiveType::DECIMAL);
     $metadata->addPrimitiveProperty($orderDetailsEntityType, 'Quantity', EdmPrimitiveType::INT16);
     $metadata->addPrimitiveProperty($orderDetailsEntityType, 'Discount', EdmPrimitiveType::SINGLE);
     //Register the entity (resource) type 'Employee'
     $employeeEntityType = $metadata->addEntityType(new \ReflectionClass('UnitTests\\POData\\Facets\\NorthWind1\\Employee2'), 'Employee');
     $metadata->addKeyProperty($employeeEntityType, 'EmployeeID', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'FirstName', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'LastName', EdmPrimitiveType::STRING);
     $metadata->addPrimitiveProperty($employeeEntityType, 'ReportsTo', EdmPrimitiveType::INT32);
     $metadata->addPrimitiveProperty($employeeEntityType, 'Emails', EdmPrimitiveType::STRING, true);
     //Set Employee entity type as MLE thus the url http://host/NorthWind.svc/Employee(1875)/$value will give the stream associated with employee with id 1875
     $employeeEntityType->setMediaLinkEntry(true);
     //Add a named stream property to the employee entity type
     //so the url http://host/NorthWind.svc/Employee(9831)/TumbNail_48X48 will give stream associated with employee's thumbnail (of size 48 x 48) image
     $streamInfo = new ResourceStreamInfo('TumbNail_48X48');
     $employeeEntityType->addNamedStream($streamInfo);
     //Register the entity (resource) sets
     $customersResourceSet = $metadata->addResourceSet('Customers', $customersEntityType);
     $ordersResourceSet = $metadata->addResourceSet('Orders', $orderEntityType);
     $productResourceSet = $metadata->addResourceSet('Products', $productEntityType);
     $orderDetailsEntitySet = $metadata->addResourceSet('Order_Details', $orderDetailsEntityType);
     $employeeSet = $metadata->addResourceSet('Employees', $employeeEntityType);
     //Register the assoications (navigations)
     //Customers (1) <==> Orders (0-*)
     $metadata->addResourceSetReferenceProperty($customersEntityType, 'Orders', $ordersResourceSet);
     $metadata->addResourceReferenceProperty($orderEntityType, 'Customer', $customersResourceSet);
     //Orders (1) <==> Order_Details (0-*)
     //Products (1) <==> Order_Details (0-*)
     $metadata->addResourceReferenceProperty($orderDetailsEntityType, 'Order', $ordersResourceSet);
     $metadata->addResourceReferenceProperty($orderDetailsEntityType, 'Product', $productResourceSet);
     $metadata->addResourceSetReferenceProperty($productEntityType, 'Order_Details', $orderDetailsEntitySet);
     $metadata->addResourceSetReferenceProperty($orderEntityType, 'Order_Details', $orderDetailsEntitySet);
     //Employees (1) <==> Employees (1) 'Manager
     //Employees (1) <==> Employees (*) 'Subordinates
     $metadata->addResourceReferenceProperty($employeeEntityType, 'Manager', $employeeSet);
     $metadata->addResourceSetReferenceProperty($employeeEntityType, 'Subordinates', $employeeSet);
     return $metadata;
 }
示例#5
0
 /**
  * Description of service
  *
  * @return IMetadataProvider
  */
 public static function create()
 {
     $metadata = new SimpleMetadataProvider('Data', self::MetaNamespace);
     $metadata->addResourceSet('Products', self::createProductEntityType($metadata));
     return $metadata;
 }