Deleted_notice and Bookmark getByPK assocative array for example.
$object = new $classname();
foreach ($pkey as $col) {
if (!array_key_exists($col, $vals)) {
- throw new ServerException("Missing primary key column '{$col}'");
+ throw new ServerException("Missing primary key column '{$col}' for ".get_called_class()." among provided keys: ".implode(',', array_keys($vals)));
} elseif (is_null($vals[$col])) {
throw new ServerException("NULL values not allowed in getByPK for column '{$col}'");
}
static public function fromStored(Notice $stored)
{
$class = get_called_class();
- return self::getByPK(array('uri', $stored->getUri()));
+ return self::getByPK(array('uri' => $stored->getUri()));
}
// The one who deleted the notice, not the notice's author
{
$uri = $this->getUri();
if (!isset($this->_stored[$uri])) {
- $this->_stored[$uri] = Notice::getByPK('uri', $uri);
+ $this->_stored[$uri] = Notice::getByPK(array('uri' => $uri));
}
return $this->_stored[$uri];
}
{
assert($obj->type == ActivityObject::BOOKMARK);
- $bm = Bookmark::getByPK(array('uri', $obj->id));
+ $bm = Bookmark::getByPK(array('uri' => $obj->id));
$out['displayName'] = $bm->getTitle();
$out['targetUrl'] = $bm->getUrl();
'description' => array('type' => 'text'),
'created' => array('type' => 'datetime', 'not null' => true),
),
- 'primary key' => array('id'),
+ 'primary key' => array('uri'),
'unique keys' => array(
- 'bookmark_uri_key' => array('uri'),
+ 'bookmark_id_key' => array('id'),
),
'foreign keys' => array(
'bookmark_profile_id_fkey' => array('profile', array('profile_id' => 'id')),
*/
static public function fromStored(Notice $stored)
{
- $class = get_called_class();
- return self::getByPK(array('uri', $stored->getUri()));
+ return self::getByPK(array('uri' => $stored->getUri()));
}
/**