ArticlesTable.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. * Article table class
  16. *
  17. */
  18. class ArticlesTable extends Table
  19. {
  20. public function initialize(array $config)
  21. {
  22. $this->belongsTo('authors');
  23. $this->belongsToMany('tags');
  24. $this->hasMany('ArticlesTags');
  25. }
  26. /**
  27. * Find published
  28. *
  29. * @param Cake\ORM\Query $query The query
  30. * @return Cake\ORM\Query
  31. */
  32. public function findPublished($query)
  33. {
  34. return $query->where(['published' => 'Y']);
  35. }
  36. /**
  37. * Example public method
  38. *
  39. * @return void
  40. */
  41. public function doSomething()
  42. {
  43. }
  44. /**
  45. * Example Secondary public method
  46. *
  47. * @return void
  48. */
  49. public function doSomethingElse()
  50. {
  51. }
  52. /**
  53. * Example protected method
  54. *
  55. * @return void
  56. */
  57. protected function _innerMethod()
  58. {
  59. }
  60. }