NonExtending.php 1007 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace TestApp\Model\Entity;
  3. use Cake\Datasource\EntityInterface;
  4. use Cake\Datasource\EntityTrait;
  5. /**
  6. * Tests entity class used for asserting correct loading
  7. *
  8. */
  9. class NonExtending implements EntityInterface
  10. {
  11. use EntityTrait;
  12. public function __construct(array $properties = [], array $options = [])
  13. {
  14. $options += [
  15. 'useSetters' => true,
  16. 'markClean' => false,
  17. 'markNew' => null,
  18. 'guard' => false,
  19. 'source' => null
  20. ];
  21. if (!empty($properties)) {
  22. $this->set($properties, [
  23. 'setter' => $options['useSetters'],
  24. 'guard' => $options['guard']
  25. ]);
  26. }
  27. if ($options['markClean']) {
  28. $this->clean();
  29. }
  30. if ($options['markNew'] !== null) {
  31. $this->isNew($options['markNew']);
  32. }
  33. if (!empty($options['source'])) {
  34. $this->source($options['source']);
  35. }
  36. }
  37. }