Profile_block.php 2.5 KB

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