BufferResultsTrait.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 3.0.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Database\Statement;
  16. /**
  17. * Contains a setter for marking a Statement as buffered
  18. *
  19. * @internal
  20. */
  21. trait BufferResultsTrait
  22. {
  23. /**
  24. * Whether or not to buffer results in php
  25. *
  26. * @var bool
  27. */
  28. protected $_bufferResults = true;
  29. /**
  30. * Whether or not to buffer results in php
  31. *
  32. * @param bool $buffer Toggle buffering
  33. * @return $this
  34. */
  35. public function bufferResults($buffer)
  36. {
  37. $this->_bufferResults = (bool)$buffer;
  38. return $this;
  39. }
  40. }