2014-04-02 67 views
1

我需要創建一個支持GET和PUT的PHP OData生產者。到目前爲止,我只發現了this library,不幸的是這不支持PUT操作。 有什麼建議嗎? 謝謝OData PHP生產者

+0

我想你應該讀元。 – Debflav

回答

1

目前沒有PHP庫(公共)可用於支持OData CUD(更改,更新和刪除)操作。

0

剛剛發佈。文檔即將到來。

https://packagist.org/packages/falseclock/dbd-php

$cache = DBD\Cache\MemCache::me()->create(array(['host' => '127.0.0.1', 'port' => 11211]),false,"15 min")->open(); 

    $odata_options = array(
     'RaiseError'  => true, 
     'PrintError'  => true, 
     'HTMLError'   => true, 
     'CacheDriver'  => $cache 
    ); 

    $od = (new DBD\OData())->create('http://crm.beta.virtex.kz/odata/', "user", "password", $odata_options); 

    $sth = $od->prepare(" 
     SELECT 
      Ref_Key, Number, Date 
     FROM 
      Document_Invoices 
     ORDER BY 
      Date аsc 
     LIMIT 10 
    "); 
    $sth->cache('CacheKey','24h'); 
    $sth->execute(); 

    while ($row = $sth->fetchrow()) { 
     print_r($row); 
    } 

$od->update(
    'Document_Invoices', 
    array('Date' => $data['Date']), 
    "(guid?)", 
    $data['Ref_Key'] // for ?-placeholder 
);