static public function fromStored(Notice $stored)
{
$class = get_called_class();
- $object = new $class;
- $object->uri = $stored->getUri(); // Lookup by delete activity's URI! (that's what is _stored_ in our db!)
- if (!$object->find(true)) {
- throw new NoResultException($object);
- }
- return $object;
+ return self::getByPK(array('uri', $stored->getUri()));
}
// The one who deleted the notice, not the notice's author
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-if (!defined('STATUSNET')) {
- exit(1);
-}
+if (!defined('GNUSOCIAL')) { exit(1); }
/**
* For storing the fact that a notice is a bookmark
),
'foreign keys' => array(
'bookmark_profile_id_fkey' => array('profile', array('profile_id' => 'id'))
+ 'bookmark_uri_fkey' => array('notice', array('uri' => 'uri'))
),
'indexes' => array('bookmark_created_idx' => array('created'),
'bookmark_url_idx' => array('url'),
/**
* Get a bookmark based on a notice
*
- * @param Notice $notice Notice to check for
+ * @param Notice $stored Notice activity which represents the Bookmark
*
- * @return Bookmark found bookmark or null
+ * @return Bookmark The found bookmark object.
+ * @throws NoResultException When you don't find it after all.
*/
- static function getByNotice($notice)
+ static public function fromStored(Notice $stored)
{
- return self::getKV('uri', $notice->uri);
+ $class = get_called_class();
+ return self::getByPK(array('uri', $stored->getUri()));
}
/**