OData SDK for PHP

联合创作 · 2023-09-21 23:08

OData 的 PHP 开发包,示例代码:

/* connect to the OData service  */
   $svc = new NorthwindEntities(NORTHWIND_SERVICE_URL);
     
/* get the list of Customers in the USA, for each customer get the list of Orders */
    $query = $svc->Customers()
                 ->filter("Country eq 'USA'")
                 ->Expand('Orders');
    $customerResponse = $query->Execute();

/* get only CustomerID and CustomerName */
    $query = $svc->Customers()
                 ->filter("Country eq 'USA'")
                 ->Select('CustomerID, CustomerName');
    $customerResponse = $query->Execute();

/* create a new customer */
    $customer = Customers::CreateCustomers('channel9', 'CHAN9');
    $proxy->AddToCustomers($customer); 

/* commit the change on the server */        
    $proxy->SaveChanges();
浏览 5
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报