CategoryThreadsTable.php 825 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
  4. * Copyright 2005-2013, Cake Software Foundation, Inc. (http://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * Redistributions of files must retain the above copyright notice
  8. *
  9. * @since 3.0.0
  10. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  11. */
  12. namespace TestApp\Model\Table;
  13. use Cake\ORM\Table;
  14. /**
  15. * CategoryThreadsTable
  16. */
  17. class CategoryThreadsTable extends Table {
  18. public function initialize(array $config) {
  19. $this->table('category_threads');
  20. $this->belongsTo('ParentCategoryThreads', [
  21. 'className' => __CLASS__,
  22. 'foreignKey' => 'parent_id'
  23. ]);
  24. $this->hasMany('ChildCategoryThreads', [
  25. 'className' => __CLASS__,
  26. 'foreignKey' => 'parent_id'
  27. ]);
  28. }
  29. }