diff lib/IMPL/Config/ServiceDescriptor.pm @ 420:df591e3afd10 ref20150831

sync
author cin
date Sat, 25 Feb 2017 22:35:26 +0300
parents 3ed0c58e9da3
children 7798345304bc
line wrap: on
line diff
--- a/lib/IMPL/Config/ServiceDescriptor.pm	Sun Jan 29 10:30:20 2017 +0300
+++ b/lib/IMPL/Config/ServiceDescriptor.pm	Sat Feb 25 22:35:26 2017 +0300
@@ -18,6 +18,7 @@
 		args       => 'r',
 		services   => 'r',
 		norequire  => 'r',
+		owner      => 'r',
 		_name      => 'rw',
 		_loaded    => 'rw'
 	]
@@ -28,15 +29,16 @@
 
 	$this->type( $opts{type} )
 	  or die IMPL::InvalidArgumentException->new('type');
+	$this->owner( $opts{owner} )
+	  or die IMPL::InvalidArgumentException->new('owner');
 
-	$this->activation(
-		IMPL::Config::Descriptor::ParseActivation( $opts{activation} ) );
+	$this->activation( SELF->ParseActivation( $opts{activation} ) );
 	$this->args( $opts{args} )           if exists $opts{args};
 	$this->services( $opts{services} )   if exists $opts{services};
 	$this->norequire( $opts{norequire} ) if exists $opts{norequire};
 
 	$this->_name( 'new {'
-		  . IMPL::Config::Descriptor::ActivationToString( $this->activation )
+		  . SELF->ActivationToString( $this->activation )
 		  . '} '
 		  . $this->type );
 }
@@ -50,13 +52,16 @@
 	my $activation = $this->activation;
 	my $cache;
 
-	if ( $activation == IMPL::Config::Descriptor::ACTIVATE_SINGLETON ) {
+	if ( $activation == SELF->ACTIVATE_SINGLETON ) {
 		$cache = $context->container->root->instances;
 	}
-	elsif ( $activation == IMPL::Config::Descriptor::ACTIVATE_CONTAINER ) {
+	elsif ( $activation == SELF->ACTIVATE_CONTAINER ) {
+		$cache = $this->owner->instances;
+	}
+	elsif ( $activation == SELF->ACTIVATE_HIERARCHY ) {
 		$cache = $context->container->instances;
 	}
-	elsif ( $activation == IMPL::Config::Descriptor::ACTIVATE_CONTEXT ) {
+	elsif ( $activation == SELF->ACTIVATE_CONTEXT ) {
 		$cache = $context->instances;
 	}