Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

71 line
2.3KB

  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\data;
  8. /**
  9. * DataProviderInterface is the interface that must be implemented by data provider classes.
  10. *
  11. * Data providers are components that sort and paginate data, and provide them to widgets
  12. * such as [[\yii\grid\GridView]], [[\yii\widgets\ListView]].
  13. *
  14. * @author Qiang Xue <qiang.xue@gmail.com>
  15. * @since 2.0
  16. */
  17. interface DataProviderInterface
  18. {
  19. /**
  20. * Prepares the data models and keys.
  21. *
  22. * This method will prepare the data models and keys that can be retrieved via
  23. * [[getModels()]] and [[getKeys()]].
  24. *
  25. * This method will be implicitly called by [[getModels()]] and [[getKeys()]] if it has not been called before.
  26. *
  27. * @param boolean $forcePrepare whether to force data preparation even if it has been done before.
  28. */
  29. public function prepare($forcePrepare = false);
  30. /**
  31. * Returns the number of data models in the current page.
  32. * This is equivalent to `count($provider->getModels())`.
  33. * When [[getPagination|pagination]] is false, this is the same as [[getTotalCount|totalCount]].
  34. * @return integer the number of data models in the current page.
  35. */
  36. public function getCount();
  37. /**
  38. * Returns the total number of data models.
  39. * When [[getPagination|pagination]] is false, this is the same as [[getCount|count]].
  40. * @return integer total number of possible data models.
  41. */
  42. public function getTotalCount();
  43. /**
  44. * Returns the data models in the current page.
  45. * @return array the list of data models in the current page.
  46. */
  47. public function getModels();
  48. /**
  49. * Returns the key values associated with the data models.
  50. * @return array the list of key values corresponding to [[getModels|models]]. Each data model in [[getModels|models]]
  51. * is uniquely identified by the corresponding key value in this array.
  52. */
  53. public function getKeys();
  54. /**
  55. * @return Sort the sorting object. If this is false, it means the sorting is disabled.
  56. */
  57. public function getSort();
  58. /**
  59. * @return Pagination the pagination object. If this is false, it means the pagination is disabled.
  60. */
  61. public function getPagination();
  62. }