[Beeframework-svn] SF.net SVN: beeframework:[44] trunk/framework/Bee
Brought to you by:
b_hartmann,
m_plomer
From: <m_p...@us...> - 2013-07-01 11:25:55
|
Revision: 44 http://sourceforge.net/p/beeframework/code/44 Author: m_plomer Date: 2013-07-01 11:25:52 +0000 (Mon, 01 Jul 2013) Log Message: ----------- - IScopeAware Modified Paths: -------------- trunk/framework/Bee/Context/Abstract.php trunk/framework/Bee/Framework.php trunk/framework/Bee/MVC/Dispatcher.php Added Paths: ----------- trunk/framework/Bee/Context/Config/IScopeAware.php Modified: trunk/framework/Bee/Context/Abstract.php =================================================================== --- trunk/framework/Bee/Context/Abstract.php 2013-06-28 17:29:46 UTC (rev 43) +++ trunk/framework/Bee/Context/Abstract.php 2013-07-01 11:25:52 UTC (rev 44) @@ -219,7 +219,7 @@ return $exposedObject; } - + /** * Initialize the given bean instance, applying factory callbacks * as well as init methods and bean post processors. @@ -229,8 +229,10 @@ * @param object $bean the new bean instance we may need to initialize * @param Bee_Context_Config_IBeanDefinition $beanDefinition the bean definition that the bean was created with * (can also be <code>null</code>, if given an existing bean instance) + * @throws Bee_Context_BeanCreationException * @return object the initialized bean instance (potentially wrapped) * @see Bee_Context_Config_IBeanNameAware + * @see \Bee\Context\Config\IScopeAware * @see Bee_Context_Config_IContextAware * @see #invokeInitMethods */ @@ -239,10 +241,14 @@ $bean->setBeanName($beanName); } + if ($bean instanceof \Bee\Context\Config\IScopeAware) { + $beanDefinition->getScope($this); + } + if ($bean instanceof Bee_Context_Config_IContextAware) { $bean->setBeeContext($this); } - + $wrappedBean = $bean; if (is_null($beanDefinition) || !$beanDefinition->isSynthetic()) { $wrappedBean = $this->applyBeanPostProcessorsBeforeInitialization($wrappedBean, $beanName); Added: trunk/framework/Bee/Context/Config/IScopeAware.php =================================================================== --- trunk/framework/Bee/Context/Config/IScopeAware.php (rev 0) +++ trunk/framework/Bee/Context/Config/IScopeAware.php 2013-07-01 11:25:52 UTC (rev 44) @@ -0,0 +1,31 @@ +<?php +namespace Bee\Context\Config; +/* + * Copyright 2008-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * User: mp + * Date: 01.07.13 + * Time: 13:21 + */ + +interface IScopeAware { + /** + * @param string $scope + * @return void + */ + public function setScope($scope); +} Modified: trunk/framework/Bee/Framework.php =================================================================== --- trunk/framework/Bee/Framework.php 2013-06-28 17:29:46 UTC (rev 43) +++ trunk/framework/Bee/Framework.php 2013-07-01 11:25:52 UTC (rev 44) @@ -259,14 +259,14 @@ echo '<div>'; echo '<div style="padding: 0 0 2px 0; margin: 10px; border: solid 1px #aaa; color: #aaa;">'; - echo '<div style="background-color: #aaa; color: #666; padding: 5px; cursor: pointer;" onclick="javascript:toggle(event);">Message</div>'; + echo '<div style="background-color: #aaa; color: #666; padding: 5px; cursor: pointer;" onclick="toggle(event);">Message</div>'; echo '<div style="padding: 5px;">'; echo $e->getMessage(); echo '</div>'; echo '</div>'; echo '<div style="padding: 0 0 2px 0; margin: 10px; border: solid 1px #aaa; color: #aaa;">'; - echo '<div style="background-color: #aaa; color: #666; padding: 5px; cursor: pointer;" onclick="javascript:toggle(event);">Stracktrace</div>'; + echo '<div style="background-color: #aaa; color: #666; padding: 5px; cursor: pointer;" onclick="toggle(event);">Stracktrace</div>'; echo '<div style="padding: 5px; font-size: 10px; display: none;">'; self::printArray($e->getTrace()); echo '</div>'; Modified: trunk/framework/Bee/MVC/Dispatcher.php =================================================================== --- trunk/framework/Bee/MVC/Dispatcher.php 2013-06-28 17:29:46 UTC (rev 43) +++ trunk/framework/Bee/MVC/Dispatcher.php 2013-07-01 11:25:52 UTC (rev 44) @@ -54,7 +54,12 @@ * * @var Bee_MVC_Dispatcher */ - private static $currentDispatcher; + private static $currentDispatcher; + + /** + * @var Bee_MVC_IHttpRequest + */ + private static $currentRequest; /** * The root context used by this dispatcher @@ -101,9 +106,15 @@ public static function get() { return self::$currentDispatcher; } - - + /** + * @return Bee_MVC_IHttpRequest + */ + public static function getCurrentRequest() { + return self::$currentRequest; + } + + /** * Allows to dispatch control to sub-controllers from within a current request. Intended to be used to include hierarchical structures * which must be also available as first-class handlers (e.g. for AJAX-based updates). * @@ -192,12 +203,12 @@ */ public function dispatch() { self::$currentDispatcher = $this; - $request = $this->buildRequestObject(); + self::$currentRequest = $this->buildRequestObject(); if(!is_null($this->filterChainProxy)) { - $this->filterChainProxy->doFilter($request, $this); + $this->filterChainProxy->doFilter(self::$currentRequest, $this); } else { - $this->doFilter($request); + $this->doFilter(self::$currentRequest); } // Bee_Cache_Manager::shutdown(); @@ -304,5 +315,4 @@ } self::includeDispatch(Bee_MVC_HttpRequest::constructRequest(MODEL::get(MODEL::CURRENT_REQUEST_KEY), $pathInfo, $params, $method)); } -} -?> \ No newline at end of file +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |