Sabre\CardDAV\Backend\PDO::getCard PHP 메소드

getCard() 공개 메소드

The same set of properties must be returned as with getCards. The only exception is that 'carddata' is absolutely required. If the card does not exist, you must return false.
public getCard ( mixed $addressBookId, string $cardUri ) : array
$addressBookId mixed
$cardUri string
리턴 array
    function getCard($addressBookId, $cardUri)
    {
        $stmt = $this->pdo->prepare('SELECT id, carddata, uri, lastmodified, etag, size FROM ' . $this->cardsTableName . ' WHERE addressbookid = ? AND uri = ? LIMIT 1');
        $stmt->execute([$addressBookId, $cardUri]);
        $result = $stmt->fetch(\PDO::FETCH_ASSOC);
        if (!$result) {
            return false;
        }
        $result['etag'] = '"' . $result['etag'] . '"';
        return $result;
    }

Usage Example

예제 #1
0
 /**
  * @depends testGetCard
  */
 function testDeleteCard()
 {
     $this->backend->deleteCard(1, 'card1');
     $result = $this->backend->getCard(1, 'card1');
     $this->assertFalse($result);
 }