mark getAppContainer as a valid way to construct app containers
this is triggerd (and not cought by the query arm) if an item from an app is queried before the app queries it's own Application instance Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
13960b69da
commit
5ca27085fc
|
@ -77,6 +77,8 @@ class App {
|
||||||
$e = new \RuntimeException('App class ' . $applicationClassName . ' is not setup via query() but directly');
|
$e = new \RuntimeException('App class ' . $applicationClassName . ' is not setup via query() but directly');
|
||||||
$setUpViaQuery = false;
|
$setUpViaQuery = false;
|
||||||
|
|
||||||
|
$classNameParts = explode('\\', trim($applicationClassName, '\\'));
|
||||||
|
|
||||||
foreach ($e->getTrace() as $step) {
|
foreach ($e->getTrace() as $step) {
|
||||||
if (isset($step['class'], $step['function'], $step['args'][0]) &&
|
if (isset($step['class'], $step['function'], $step['args'][0]) &&
|
||||||
$step['class'] === ServerContainer::class &&
|
$step['class'] === ServerContainer::class &&
|
||||||
|
@ -84,6 +86,12 @@ class App {
|
||||||
$step['args'][0] === $applicationClassName) {
|
$step['args'][0] === $applicationClassName) {
|
||||||
$setUpViaQuery = true;
|
$setUpViaQuery = true;
|
||||||
break;
|
break;
|
||||||
|
} else if (isset($step['class'], $step['function'], $step['args'][0]) &&
|
||||||
|
$step['class'] === ServerContainer::class &&
|
||||||
|
$step['function'] === 'getAppContainer' &&
|
||||||
|
$step['args'][1] === $classNameParts[1]) {
|
||||||
|
$setUpViaQuery = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue