X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=plugins%2FPoll%2Fclasses%2FPoll.php;h=1296733c99c9b1fa0f96291526dec3cbc305bdc2;hb=d6b28c64830f632bb2f4b6f3c9369b9e56ad217a;hp=15441420285d332cdf5daac06fac8b2c44d04e1a;hpb=bc8e114b375bbe378440f2d33ea2577efade95b6;p=quix0rs-gnu-social.git diff --git a/plugins/Poll/classes/Poll.php b/plugins/Poll/classes/Poll.php index 1544142028..1296733c99 100644 --- a/plugins/Poll/classes/Poll.php +++ b/plugins/Poll/classes/Poll.php @@ -47,7 +47,7 @@ class Poll extends Managed_DataObject { public $__table = 'poll'; // table name public $id; // char(36) primary key not null -> UUID - public $uri; + public $uri; // varchar(191) not 255 because utf8mb4 takes more space public $profile_id; // int -> profile.id public $question; // text public $options; // text; newline(?)-delimited @@ -62,7 +62,7 @@ class Poll extends Managed_DataObject 'description' => 'Per-notice poll data for Poll plugin', 'fields' => array( 'id' => array('type' => 'char', 'length' => 36, 'not null' => true, 'description' => 'UUID'), - 'uri' => array('type' => 'varchar', 'length' => 255, 'not null' => true), + 'uri' => array('type' => 'varchar', 'length' => 191, 'not null' => true), 'profile_id' => array('type' => 'int'), 'question' => array('type' => 'text'), 'options' => array('type' => 'text'), @@ -82,7 +82,7 @@ class Poll extends Managed_DataObject * * @return Poll found poll or null */ - static function getByNotice($notice) + static function getByNotice(Notice $notice) { return self::getKV('uri', $notice->uri); } @@ -167,12 +167,8 @@ class Poll extends Managed_DataObject * * @return Notice saved notice */ - static function saveNew($profile, $question, $opts, $options=null) + static function saveNew(Profile $profile, $question, $opts, array $options = array()) { - if (empty($options)) { - $options = array(); - } - $p = new Poll(); $p->id = UUID::gen();