PageRenderTime 28ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/Taxonomy/Model/Vocabulary.php

https://github.com/kareypowell/croogo
PHP | 101 lines | 56 code | 8 blank | 37 comment | 0 complexity | 8af4b0e489c45580d313aa864f6cf168 MD5 | raw file
  1. <?php
  2. App::uses('TaxonomyAppModel', 'Taxonomy.Model');
  3. /**
  4. * Vocabulary
  5. *
  6. * @category Taxonomy.Model
  7. * @package Croogo.Taxonomy.Model
  8. * @version 1.0
  9. * @author Fahad Ibnay Heylaal <contact@fahad19.com>
  10. * @license http://www.opensource.org/licenses/mit-license.php The MIT License
  11. * @link http://www.croogo.org
  12. */
  13. class Vocabulary extends TaxonomyAppModel {
  14. /**
  15. * Model name
  16. *
  17. * @var string
  18. * @access public
  19. */
  20. public $name = 'Vocabulary';
  21. /**
  22. * Behaviors used by the Model
  23. *
  24. * @var array
  25. * @access public
  26. */
  27. public $actsAs = array(
  28. 'Croogo.Ordered' => array(
  29. 'field' => 'weight',
  30. 'foreign_key' => false,
  31. ),
  32. 'Croogo.Cached' => array(
  33. 'groups' => array(
  34. 'taxonomy',
  35. ),
  36. ),
  37. 'Croogo.Trackable',
  38. );
  39. /**
  40. * Validation
  41. *
  42. * @var array
  43. * @access public
  44. */
  45. public $validate = array(
  46. 'title' => array(
  47. 'rule' => array('minLength', 1),
  48. 'message' => 'Title cannot be empty.',
  49. ),
  50. 'alias' => array(
  51. 'isUnique' => array(
  52. 'rule' => 'isUnique',
  53. 'message' => 'This alias has already been taken.',
  54. ),
  55. 'minLength' => array(
  56. 'rule' => array('minLength', 1),
  57. 'message' => 'Alias cannot be empty.',
  58. ),
  59. ),
  60. );
  61. /**
  62. * Model associations: hasAndBelongsToMany
  63. *
  64. * @var array
  65. * @access public
  66. */
  67. public $hasAndBelongsToMany = array(
  68. 'Type' => array(
  69. 'className' => 'Taxonomy.Type',
  70. 'joinTable' => 'types_vocabularies',
  71. 'foreignKey' => 'vocabulary_id',
  72. 'associationForeignKey' => 'type_id',
  73. 'unique' => true,
  74. 'conditions' => '',
  75. 'fields' => '',
  76. 'order' => '',
  77. 'limit' => '',
  78. 'offset' => '',
  79. 'finderQuery' => '',
  80. 'deleteQuery' => '',
  81. 'insertQuery' => '',
  82. ),
  83. );
  84. /**
  85. * Model associations: hasMany
  86. */
  87. public $hasMany = array(
  88. 'Taxonomy' => array(
  89. 'className' => 'Taxonomy.Taxonomy',
  90. 'dependent' => true,
  91. ),
  92. );
  93. }