Conversation.php

Summary
Conversation.php
ConversationData class for Conversations
ConversationBase superclass for Conversations
schemaDefReturns an array with the table schema definition
beforeSchemaUpdateCleanup to do prior to database schema checks.
createFactory method for creating a new conversation.
noticeCountHow many notices are in this conversation?
getUrlFromNoticeGet the URL of the specified notice in the conversation.
getUriGet the URI of the conversation
getUrlGet the URL of the conversation
getNoticesRetrieve the notices of the conversation.

Conversation

Data class for Conversations

postActiv

the micro-blogging software

Copyright

Copyright © 2016-2017, Maiyannah Bishop

Derived from code copyright various sources

  • GNU Social © 2013-2016, Free Software Foundation, Inc
  • StatusNet © 2008-2012, StatusNet, Inc

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program.  If not, see http://www.gnu.org/licenses/.

https://www.gnu.org/licenses/agpl.html

About

Data class for Conversations

PHP version

Tested with PHP 7

File Authors

Web

Conversation

Base superclass for Conversations

Variables

  • $__table - table name (‘conversation’)
  • $id - int(4) primary_key not_null auto_increment
  • $uri - varchar(191) unique_key not 255 because utf8mb4 takes more space
  • $created - datetime not_null
  • $modified - timestamp not_null default_CURRENT_TIMESTAMP
Summary
schemaDefReturns an array with the table schema definition
beforeSchemaUpdateCleanup to do prior to database schema checks.
createFactory method for creating a new conversation.
noticeCountHow many notices are in this conversation?
getUrlFromNoticeGet the URL of the specified notice in the conversation.
getUriGet the URI of the conversation
getUrlGet the URL of the conversation
getNoticesRetrieve the notices of the conversation.

schemaDef

public static function schemaDef()

Returns an array with the table schema definition

beforeSchemaUpdate

static public function beforeSchemaUpdate()

Cleanup to do prior to database schema checks.

create

static function create($uri = null,
$created = null)

Factory method for creating a new conversation.

Use this for locally initiated conversations.  Remote notices should preferrably supply their own conversation URIs in the OStatus feed.

Returns

  • Conversation $conv - the new conversation DO

noticeCount

static function noticeCount($id)

How many notices are in this conversation?

Returns

  • integer $cnt

getUrlFromNotice

static public function getUrlFromNotice(Notice $notice,  
 $anchor = true)

Get the URL of the specified notice in the conversation.

Parameters

  • Notice $notice
  • boolean $anchor (default TRUE)

Returns

  • Url of Notice

getUri

public function getUri()

Get the URI of the conversation

Returns

  • string $uri

getUrl

public function getUrl($noticeId = null)

Get the URL of the conversation

Parameters

  • integer noticeId (default NULL)

Returns

  • string $url - the URL location of this conversation

getNotices

public function getNotices(Profile $scoped = null,
 $offset = 0,
 $limit = 500)

Retrieve the notices of the conversation.

FIXME

...will 500 ever be too low?  Taken from ConversationAction::MAX_NOTICES

Parameters

  • Profile $scoped (default NULL)
  • integer $offset (default 0)
  • integer $limit (default 500)

Returns

  • array of Notice objects
public static function schemaDef()
Returns an array with the table schema definition
static public function beforeSchemaUpdate()
Cleanup to do prior to database schema checks.
static function create($uri = null,
$created = null)
Factory method for creating a new conversation.
static function noticeCount($id)
How many notices are in this conversation?
static public function getUrlFromNotice(Notice $notice,  
 $anchor = true)
Get the URL of the specified notice in the conversation.
public function getUri()
Get the URI of the conversation
public function getUrl($noticeId = null)
Get the URL of the conversation
public function getNotices(Profile $scoped = null,
 $offset = 0,
 $limit = 500)
Retrieve the notices of the conversation.