NonExtending.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. $this->_className = get_class($this);
  22. if (!empty($properties)) {
  23. $this->set($properties, [
  24. 'setter' => $options['useSetters'],
  25. 'guard' => $options['guard']
  26. ]);
  27. }
  28. if ($options['markClean']) {
  29. $this->clean();
  30. }
  31. if ($options['markNew'] !== null) {
  32. $this->isNew($options['markNew']);
  33. }
  34. if (!empty($options['source'])) {
  35. $this->source($options['source']);
  36. }
  37. }
  38. }