Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix event args parameter type hint #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions EventSubscriber/ReadOnlySubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs;
use steevanb\DoctrineReadOnlyHydrator\Hydrator\SimpleObjectHydrator;
use Doctrine\Common\EventSubscriber;
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PreFlushEventArgs;
use Doctrine\ORM\Events;
use steevanb\DoctrineReadOnlyHydrator\Entity\ReadOnlyEntityInterface;
Expand All @@ -26,10 +25,10 @@ public function getSubscribedEvents()
}

/**
* @param LifecycleEventArgs $args
* @param \Doctrine\Common\Persistence\Event\LifecycleEventArgs|\Doctrine\ORM\Event\LifecycleEventArgs $args
* @throws ReadOnlyEntityCantBePersistedException
*/
public function prePersist(LifecycleEventArgs $args)
public function prePersist($args)
{
if ($this->isReadOnlyEntity($args->getObject())) {
throw new ReadOnlyEntityCantBePersistedException($args->getObject());
Expand Down Expand Up @@ -70,8 +69,8 @@ public function onClassMetadataNotFound(OnClassMetadataNotFoundEventArgs $eventA
} catch (\Exception $exception) {}
}

/** @param LifecycleEventArgs $eventArgs */
public function postLoad(LifecycleEventArgs $eventArgs)
/** @param \Doctrine\Common\Persistence\Event\LifecycleEventArgs|\Doctrine\ORM\Event\LifecycleEventArgs $eventArgs */
public function postLoad($eventArgs)
{
if ($eventArgs->getObject() instanceof ReadOnlyEntityInterface) {
// add ReadOnlyProxy to classMetada list
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### [2.4.0](../../compare/2.3.0...2.4.0) (2021-10-19)

- Update dependency: `doctrine/orm` from `^2.4.8` to `^2.5`, it was not working with `2.4`
- Add dependencies (it was already used by previous version): `doctrine/collections`

### [2.3.0](../../compare/2.2.4...2.3.0) (2021-03-28)

- [lerminou](https://github.com/lerminou) Allow PHP8 in `composer.json`
Expand Down
15 changes: 11 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,23 @@
"license": "MIT",
"description": "Fast hydratation for read only purpose",
"autoload": {
"psr-4": { "steevanb\\DoctrineReadOnlyHydrator\\": "" },
"psr-4": {
"steevanb\\DoctrineReadOnlyHydrator\\": ""
},
"exclude-from-classmap": [
"/ComposerOverloadClass/"
]
},
"require": {
"php" : "^5.4.6 || ^7.0 || ^8.0",
"doctrine/orm": "^2.4.8"
"php": "^5.4.6 || ^7.0 || ^8.0",
"ext-tokenizer": "*",
"doctrine/collections": "^1.1",
"doctrine/orm": "^2.5"
},
"suggest": {
"steevanb/doctrine-stats": "Add Doctrine stats : hydration time, lazy loaded entities, managed entities etc."
"steevanb/doctrine-stats": "Add Doctrine stats: hydration time, lazy loaded entities, managed entities etc."
},
"config": {
"sort-packages": true
}
}