Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Zend\Di
Browse files Browse the repository at this point in the history
- Fixed such that type preferences can be objects
  • Loading branch information
Ralph Schindler committed Oct 7, 2011
1 parent f47a1b7 commit a9a0285
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Di.php
Expand Up @@ -459,6 +459,10 @@ protected function resolveMethodParameters($class, $method, array $callTimeUserP
if ($alias && $this->instanceManager->hasTypePreferences($alias)) {
$pInstances = $this->instanceManager->getTypePreferences($alias);
foreach ($pInstances as $pInstance) {
if (is_object($pInstance)) {
$computedParams['value'][$fqName] = $pInstance;
continue 2;
}
$pInstanceClass = ($this->instanceManager->hasAlias($pInstance)) ?
$this->instanceManager->getClassFromAlias($pInstance) : $pInstance;
if ($pInstanceClass === $type || $this->isSubclassOf($pInstanceClass, $type)) {
Expand All @@ -472,6 +476,10 @@ protected function resolveMethodParameters($class, $method, array $callTimeUserP
if ($type && $this->instanceManager->hasTypePreferences($type)) {
$pInstances = $this->instanceManager->getTypePreferences($type);
foreach ($pInstances as $pInstance) {
if (is_object($pInstance)) {
$computedParams['value'][$fqName] = $pInstance;
continue 2;
}
$pInstanceClass = ($this->instanceManager->hasAlias($pInstance)) ?
$this->instanceManager->getClassFromAlias($pInstance) : $pInstance;
if ($pInstanceClass === $type || $this->isSubclassOf($pInstanceClass, $type)) {
Expand Down

0 comments on commit a9a0285

Please sign in to comment.