NonExtending.php 1005 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. class NonExtending implements EntityInterface
  9. {
  10. use EntityTrait;
  11. public function __construct(array $properties = [], array $options = [])
  12. {
  13. $options += [
  14. 'useSetters' => true,
  15. 'markClean' => false,
  16. 'markNew' => null,
  17. 'guard' => false,
  18. 'source' => null,
  19. ];
  20. if (!empty($properties)) {
  21. $this->set($properties, [
  22. 'setter' => $options['useSetters'],
  23. 'guard' => $options['guard'],
  24. ]);
  25. }
  26. if ($options['markClean']) {
  27. $this->clean();
  28. }
  29. if ($options['markNew'] !== null) {
  30. $this->isNew($options['markNew']);
  31. }
  32. if (!empty($options['source'])) {
  33. $this->source($options['source']);
  34. }
  35. }
  36. }