-
Notifications
You must be signed in to change notification settings - Fork 379
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
[WIP] Added resolve events to cache manager #388
Conversation
|
||
$this->dispatcher->dispatch(ImagineEvents::PRE_RESOLVE, new PreResolveEvent($resolver, $path, $filter)); | ||
|
||
$url = $resolver->resolve($path, $filter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolver, path, amd filter has to be taken from the event
@makasim review please |
*/ | ||
protected $url; | ||
|
||
public function __construct(ResolverInterface $resolver, $path, $filter, $url = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc blocks, not only here
tests of cource |
@makasim, review please |
@@ -176,7 +188,21 @@ public function resolve($path, $filter) | |||
throw new NotFoundHttpException(sprintf("Source image was searched with '%s' outside of the defined root path", $path)); | |||
} | |||
|
|||
return $this->getResolver($filter)->resolve($path, $filter); | |||
/** @var CacheResolveEvent $event */ | |||
$event = $this->dispatcher->dispatch(ImagineEvents::PRE_RESOLVE, new CacheResolveEvent( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$preEvent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$preEvent = new CacheResolveEvent($path, $filter));
$this->dispatcher->dispatch(ImagineEvents::PRE_RESOLVE, $preEvent):
…CacheResolverEvent.
@makasim, review please |
class CacheResolveEvent extends Event | ||
{ | ||
/** | ||
* Resource path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is useless, please remove such comment
@makasim, fixed. Review please |
$this->event = null; | ||
} | ||
|
||
public function testGetPath() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/**
* @test
*/
public function shouldAllowSetPath();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldAllowGetPathPreviouslySet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldAllowGetPathSetInConstructor
$cacheManager->addResolver($expectedFilterOne, $resolver); | ||
$cacheManager->addResolver($expectedFilterTwo, $resolver); | ||
|
||
$cacheManager->remove(null, array($expectedFilterOne, $expectedFilterTwo)); | ||
} | ||
|
||
public function testShouldBeDispatchedCachePreResolveEvent() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testShouldDispatchCachePreResolveEvent
@makasim, fixed, review please |
$preEvent = new CacheResolveEvent($path, $filter); | ||
$this->dispatcher->dispatch(ImagineEvents::PRE_RESOLVE, $preEvent); | ||
|
||
$url = $this->getResolver($filter)->resolve($preEvent->getPath(), $preEvent->getFilter()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->getResolver($filter)
-> $this->getResolver($preEvent->getFilter())
@makasim, fixed, review please |
@serdyuka looks good, I am waiting for green from CI and merge this |
[WIP] Added resolve events to cache manager
WIP