Profile_block.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. // This file is part of GNU social - https://www.gnu.org/software/social
  3. //
  4. // GNU social is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Affero General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // GNU social is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Affero General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Affero General Public License
  15. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  16. /*
  17. * Table Definition for profile_block
  18. *
  19. * @copyright 2008, 2009 StatusNet, Inc.
  20. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  21. */
  22. defined('GNUSOCIAL') || die();
  23. class Profile_block extends Managed_DataObject
  24. {
  25. ###START_AUTOCODE
  26. /* the code below is auto generated do not remove the above tag */
  27. public $__table = 'profile_block'; // table name
  28. public $blocker; // int(4) primary_key not_null
  29. public $blocked; // int(4) primary_key not_null
  30. public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
  31. /* the code above is auto generated do not remove the tag below */
  32. ###END_AUTOCODE
  33. public static function schemaDef()
  34. {
  35. return array(
  36. 'fields' => array(
  37. 'blocker' => array('type' => 'int', 'not null' => true, 'description' => 'user making the block'),
  38. 'blocked' => array('type' => 'int', 'not null' => true, 'description' => 'profile that is blocked'),
  39. 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date of blocking'),
  40. ),
  41. 'foreign keys' => array(
  42. 'profile_block_blocker_fkey' => array('user', array('blocker' => 'id')),
  43. 'profile_block_blocked_fkey' => array('profile', array('blocked' => 'id')),
  44. ),
  45. 'primary key' => array('blocker', 'blocked'),
  46. 'indexes' => array(
  47. 'profile_block_blocked_idx' => array('blocked'),
  48. ),
  49. );
  50. }
  51. public static function exists(Profile $blocker, Profile $blocked)
  52. {
  53. return Profile_block::pkeyGet(array('blocker' => $blocker->id,
  54. 'blocked' => $blocked->id));
  55. }
  56. }