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);
 }