OData PHP制作人

时间:2014-04-02 08:02:55

标签: php web-services odata

我需要创建一个支持GET和PUT的PHP OData生成器。到目前为止,我只发现this library,遗憾的是这不支持PUT操作。 有什么建议? 感谢的

2 个答案:

答案 0 :(得分:1)

目前没有可用的PHP库(公共)支持OData CUD(更改,更新和删除)操作。

答案 1 :(得分: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
);