public function createCard($addressBookId, $cardUri, $cardData)
    {
        $stmt = $this->pdo->prepare('INSERT INTO '.$this->cardsTableName.' (carddata, uri, lastmodified, addressbookid, size, etag) VALUES (?, ?, ?, ?, ?, ?)');

        $etag = md5($cardData);

        $stmt->execute([
            $cardData,
            $cardUri,
            time(),
            $addressBookId,
            strlen($cardData),
            $etag,
        ]);

        $this->addChange($addressBookId, $cardUri, 1);

        return '"'.$etag.'"';
    }
public function createCard($addressBookId, $cardUri, $cardData)
    {
        $stmt = $this->pdo->prepare('INSERT INTO '.$this->cardsTableName.' (carddata, uri, lastmodified, addressbookid, size, etag) VALUES (?, ?, ?, ?, ?, ?)');

        $etag = md5($cardData);

        $stmt->execute([
            $cardData,
            $cardUri,
            time(),
            $addressBookId,
            strlen($cardData),
            $etag,
        ]);

        $this->addChange($addressBookId, $cardUri, 1);

        return '"'.$etag.'"';
    }
public function createCard ( $ addressBookId , $ cardUri , $ cardData ) { $ stmt = $ this -> pdo -> prepare ( 'INSERT INTO ' . $ this -> cardsTableName . ' (carddata, uri, lastmodified, addressbookid, size, etag) VALUES (?, ?, ?, ?, ?, ?)' ) ; $ etag = md5 ( $ cardData ) ; $ stmt -> execute ( [ $ cardData , $ cardUri , time ( ) , $ addressBookId , strlen ( $ cardData ) , $ etag , ] ) ; $ this -> addChange ( $ addressBookId , $ cardUri , 1 ) ; return '"' . $ etag . '"' ; }
Creates a new card.

The addressbook id will be passed as the first argument. This is the
same id as it is returned from the getAddressBooksForUser method.

The cardUri is a base uri, and doesn't include the full path. The
cardData argument is the vcard body, and is passed as a string.

It is possible to return an ETag from this method. This ETag is for the
newly created resource, and must be enclosed with double quotes (that
is, the string itself must contain the double quotes).

You should only return the ETag if you store the carddata as-is. If a
subsequent GET request on the same card does not have the same body,
byte-by-byte and you did return an ETag here, clients tend to get
confused.

If you don't return an ETag, you can just return null.

@param mixed  $addressBookId
@param string $cardUri
@param string $cardData

@return string|null
Creates a new card .