MockDocumentMultipleKey.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * Lithium: the most rad php framework
  4. *
  5. * @copyright Copyright 2013, Union of RAD (http://union-of-rad.org)
  6. * @license http://opensource.org/licenses/bsd-license.php The BSD License
  7. */
  8. namespace lithium\tests\mocks\data\model;
  9. use lithium\data\Schema;
  10. use lithium\data\entity\Document;
  11. class MockDocumentMultipleKey extends \lithium\data\Model {
  12. public static $connection;
  13. protected $_meta = array(
  14. 'key' => array('id', 'rev'),
  15. 'name' => null,
  16. 'title' => null,
  17. 'class' => null,
  18. 'source' => null,
  19. 'connection' => false,
  20. 'initialized' => false
  21. );
  22. public static function __init(array $options = array()) {}
  23. public function ret($record, $param1 = null, $param2 = null) {
  24. if ($param2) {
  25. return $param2;
  26. }
  27. if ($param1) {
  28. return $param1;
  29. }
  30. return null;
  31. }
  32. public static function find($type = 'all', array $options = array()) {
  33. if ($type === 'first') {
  34. return new Document(array('data' => array(
  35. 'id' => 2, 'rev' => '1-1', 'name' => 'Two', 'content' => 'Lorem ipsum two'
  36. )));
  37. }
  38. return new Document(array('data' => array(
  39. array('id' => 1, 'rev' => '1-1','name' => 'One', 'content' => 'Lorem ipsum one'),
  40. array('id' => 2, 'rev' => '1-1','name' => 'Two', 'content' => 'Lorem ipsum two'),
  41. array('id' => 3, 'rev' => '1-1', 'name' => 'Three', 'content' => 'Lorem ipsum three')
  42. )));
  43. }
  44. }
  45. ?>