当前位置: 首页>>代码示例>>PHP>>正文


PHP Feed::setId方法代码示例

本文整理汇总了PHP中Feed::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Feed::setId方法的具体用法?PHP Feed::setId怎么用?PHP Feed::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Feed的用法示例。


在下文中一共展示了Feed::setId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testToAPI

 public function testToAPI()
 {
     $feed = new Feed();
     $feed->setId(3);
     $feed->setUrl('http://google');
     $feed->setTitle('title');
     $feed->setFaviconLink('favicon');
     $feed->setAdded(123);
     $feed->setFolderId(1);
     $feed->setUnreadCount(321);
     $feed->setLink('https://google');
     $this->assertEquals(array('id' => 3, 'url' => 'http://google', 'title' => 'title', 'faviconLink' => 'favicon', 'added' => 123, 'folderId' => 1, 'unreadCount' => 321, 'link' => 'https://google'), $feed->toAPI());
 }
开发者ID:hroo772,项目名称:news,代码行数:13,代码来源:FeedTest.php

示例2: createFeed

 private function createFeed()
 {
     $feed = new Feed();
     $feed->setId(3);
     $feed->setLastModified(44);
     $feed->setEtag(45);
     $feed->setUrl('http://google.com/some/weird/path');
     $feed->setTitle('title');
     $feed->setFaviconLink('favicon');
     $feed->setAdded(123);
     $feed->setFolderId(1);
     $feed->setUnreadCount(321);
     $feed->setLink('https://www.google.com/some/weird/path');
     $feed->setLocation('http://google.at');
     $feed->setOrdering(2);
     return $feed;
 }
开发者ID:sbambach,项目名称:news,代码行数:17,代码来源:FeedTest.php

示例3: testDelete

 public function testDelete()
 {
     $feed = new Feed();
     $feed->setId(3);
     $sql = 'DELETE FROM `*PREFIX*news_feeds` WHERE `id` = ?';
     $arguments = [$feed->getId()];
     $sql2 = 'DELETE FROM `*PREFIX*news_items` WHERE `feed_id` = ?';
     $arguments2 = [$feed->getId()];
     $pdoResult = $this->getMock('Result', ['fetch']);
     $pdoResult->expects($this->any())->method('fetch');
     $this->setMapperResult($sql, $arguments);
     $this->setMapperResult($sql2, $arguments2);
     $this->mapper->delete($feed);
 }
开发者ID:cs-team,项目名称:news,代码行数:14,代码来源:FeedMapperTest.php

示例4: save

    public function save(Feed $feed, $folderid)
    {
        $title = $feed->getTitle();
        $url = $feed->getUrl();
        $url_hash = md5($url);
        if (empty($title)) {
            $l = \OC_L10N::get('news');
            $title = $l->t('no title');
        }
        $favicon = $feed->getFavicon();
        //FIXME: Detect when feed contains already a database id
        $feedid = $this->findIdFromUrl($url);
        if ($feedid === null) {
            $query = \OCP\DB::prepare("\n\t\t\t\tINSERT INTO " . self::tableName . "(url, url_hash, title, favicon_link, folder_id, user_id, added, lastmodified)\n\t\t\t\tVALUES (?, ?, ?, ?, ?, ?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP())\n\t\t\t\t");
            $params = array($url, $url_hash, $title, $favicon, $folderid, $this->userid);
            $query->execute($params);
            $feedid = \OCP\DB::insertid(self::tableName);
        } else {
            //update the db. it needs to be done, since it might be the first save after a full fetch
            $stmt = \OCP\DB::prepare('
					UPDATE ' . self::tableName . ' SET favicon_link = ? , lastmodified = UNIX_TIMESTAMP() , folder_id = ?
					WHERE id = ?
					');
            $params = array($favicon, $folderid, $feedid);
            $stmt->execute($params);
        }
        $feed->setId($feedid);
        $itemMapper = new ItemMapper();
        $items = $feed->getItems();
        if ($items !== null) {
            foreach ($items as $item) {
                $itemMapper->save($item, $feedid);
            }
        }
        return $feedid;
    }
开发者ID:netcon-source,项目名称:apps,代码行数:36,代码来源:feedmapper.php


注:本文中的Feed::setId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。