diff options
author | wei <> | 2006-12-16 03:56:03 +0000 |
---|---|---|
committer | wei <> | 2006-12-16 03:56:03 +0000 |
commit | ddc0de38f64e5834ce04f0407a8416172b596655 (patch) | |
tree | a94c75b6e7a4f443f748124b84e30d02826bb23a /framework/DataAccess/SQLMap/DataMapper/TLazyLoadList.php | |
parent | c8689010d28a0fe2a734131a2964d7df394cdf6c (diff) |
removed adodb and framework/DataAccess
Diffstat (limited to 'framework/DataAccess/SQLMap/DataMapper/TLazyLoadList.php')
-rw-r--r-- | framework/DataAccess/SQLMap/DataMapper/TLazyLoadList.php | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/framework/DataAccess/SQLMap/DataMapper/TLazyLoadList.php b/framework/DataAccess/SQLMap/DataMapper/TLazyLoadList.php deleted file mode 100644 index 465dcaac..00000000 --- a/framework/DataAccess/SQLMap/DataMapper/TLazyLoadList.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php
-
-class TLazyLoadList implements IInterceptor
-{
- private $_param;
- private $_target;
- private $_propertyName='';
- private $_sqlMap;
- private $_statementName='';
- private $_loaded=false;
- private $_innerList;
-
- protected function __construct($mappedStatement, $param, $target, $propertyName)
- {
- $this->_param = $param;
- $this->_target = $target;
- $this->_statementName = $mappedStatement->getID();
- $this->_sqlMap = $mappedStatement->getSqlMap();
- $this->_propertyName = $propertyName;
- }
-
- public static function newInstance($mappedStatement, $param, $target, $propertyName)
- {
- $handler = new self($mappedStatement, $param, $target, $propertyName);
- $statement = $mappedStatement->getStatement();
- $list = $statement->createInstanceOfListClass();
- if(!is_object($list))
- throw new TSqlMapExecutionException('sqlmap_invalid_lazyload_list',
- $statement->getID());
- return new TObjectProxy($handler, $list);
- }
-
- public function intercept($method, $arguments)
- {
- return call_user_func_array(array($this->_innerList, $method), $arguments);
- }
-
- protected function fetchListData()
- {
-
- if($this->_loaded == false)
- {
- $this->_innerList = $this->_sqlMap->queryForList(
- $this->_statementName, $this->_param);
- $this->_loaded = true;
- //replace the target property with real list
- TPropertyAccess::set($this->_target,
- $this->_propertyName, $this->_innerList);
- }
- }
-
- public function hasMethod($method)
- {
- $this->fetchListData();
- if(is_object($this->_innerList))
- return in_array($method, get_class_methods($this->_innerList));
- return false;
- }
-}
-
-interface IInterceptor
-{
- public function intercept($method, $params);
- public function hasMethod($method);
-}
-
-class TObjectProxy
-{
- private $_object;
- private $_handler;
-
- public function __construct(IInterceptor $handler, $object)
- {
- $this->_handler = $handler;
- $this->_object = $object;
- }
-
- public function __call($method,$params)
- {
- if($this->_handler->hasMethod($method))
- return $this->_handler->intercept($method, $params);
- else
- return call_user_func_array(array($this->_object, $method), $params);
- }
-}
-
-?>
\ No newline at end of file |