This repository has been archived by the owner on Jan 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hydrator ignores private/protected getter/setter
If the entity had a getter/setter which was private or protected the hydrator tried to call it anyway and thus threw an exception. We now silently ignore them if there are not callable. This allow for entities that have "read-only" fields which are set internally (such as timestamp).
- Loading branch information
Showing
3 changed files
with
96 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
tests/DoctrineModuleTest/Stdlib/Hydrator/Asset/SimplePrivateEntity.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace DoctrineModuleTest\Stdlib\Hydrator\Asset; | ||
|
||
class SimplePrivateEntity | ||
{ | ||
private function setPrivate($value) | ||
{ | ||
throw new \Exception('Should never be called'); | ||
} | ||
|
||
private function getPrivate() | ||
{ | ||
throw new \Exception('Should never be called'); | ||
} | ||
|
||
protected function setProtected($value) | ||
{ | ||
throw new \Exception('Should never be called'); | ||
} | ||
|
||
protected function getProtected() | ||
{ | ||
throw new \Exception('Should never be called'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters