diff --git a/src/Datasource/EntityTrait.php b/src/Datasource/EntityTrait.php index 5b6928e1366..600191d600e 100644 --- a/src/Datasource/EntityTrait.php +++ b/src/Datasource/EntityTrait.php @@ -794,9 +794,9 @@ protected function _readError($object, $path = null) * This value could not be patched into the entity and is simply copied into the _invalid property for debugging purposes * or to be able to log it away. * - * @param string|array|null $field - * @param string|null $value - * @param bool $overwrite + * @param string|array|null $field The field to get invalid value for, or the value to set. + * @param mixed|null $value The invalid value to be set for $field. + * @param bool $overwrite Whether or not to overwrite pre-existing values for $field. * @return $this|mixed */ public function invalid($field = null, $value = null, $overwrite = false) diff --git a/src/Datasource/InvalidPropertyInterface.php b/src/Datasource/InvalidPropertyInterface.php index 45bd4190e52..60c3d20779e 100644 --- a/src/Datasource/InvalidPropertyInterface.php +++ b/src/Datasource/InvalidPropertyInterface.php @@ -27,9 +27,9 @@ interface InvalidPropertyInterface * This value could not be patched into the entity and is simply copied into the _invalid property for debugging purposes * or to be able to log it away. * - * @param string|array|null $field - * @param string|null $value - * @param bool $overwrite + * @param string|array|null $field The field to get invalid value for, or the value to set. + * @param mixed|null $value The invalid value to be set for $field. + * @param bool $overwrite Whether or not to overwrite pre-existing values for $field. * @return $this|mixed */ public function invalid($field = null, $value = null, $overwrite = false); diff --git a/src/ORM/Entity.php b/src/ORM/Entity.php index 58be2b33e46..c8248c876ab 100644 --- a/src/ORM/Entity.php +++ b/src/ORM/Entity.php @@ -15,8 +15,8 @@ namespace Cake\ORM; use Cake\Datasource\EntityInterface; -use Cake\Datasource\InvalidPropertyInterface; use Cake\Datasource\EntityTrait; +use Cake\Datasource\InvalidPropertyInterface; /** * An entity represents a single result row from a repository. It exposes the @@ -24,7 +24,6 @@ */ class Entity implements EntityInterface, InvalidPropertyInterface { - use EntityTrait; /** diff --git a/tests/TestCase/ORM/EntityTest.php b/tests/TestCase/ORM/EntityTest.php index e18894014c5..f5f1048b1b1 100644 --- a/tests/TestCase/ORM/EntityTest.php +++ b/tests/TestCase/ORM/EntityTest.php @@ -1205,6 +1205,7 @@ public function testDebugInfo() $entity->virtualProperties(['baz']); $entity->dirty('foo', true); $entity->errors('foo', ['An error']); + $entity->invalid('foo', 'a value'); $entity->source('foos'); $result = $entity->__debugInfo(); $expected = [ @@ -1216,6 +1217,7 @@ public function testDebugInfo() '[original]' => [], '[virtual]' => ['baz'], '[errors]' => ['foo' => ['An error']], + '[invalid]' => ['foo' => 'a value'], '[repository]' => 'foos' ]; $this->assertSame($expected, $result); diff --git a/tests/TestCase/ORM/MarshallerTest.php b/tests/TestCase/ORM/MarshallerTest.php index 26fe25dff79..16060cfd44b 100644 --- a/tests/TestCase/ORM/MarshallerTest.php +++ b/tests/TestCase/ORM/MarshallerTest.php @@ -2524,11 +2524,12 @@ public function testPassingCustomValidator() } /** - * Tests that invalid propery is being filled when data cannot be patched into an entity + * Tests that invalid property is being filled when data cannot be patched into an entity. * * @return void */ - public function testValidationWithInvalidFilled() { + public function testValidationWithInvalidFilled() + { $data = [ 'title' => 'foo', 'number' => 'bar',