Changeset 4303
- Timestamp:
- 04/30/08 06:12:50 (14 months ago)
- Location:
- branches/0.11/lib/Doctrine
- Files:
-
- 2 modified
-
Query/Abstract.php (modified) (1 diff)
-
View.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/lib/Doctrine/Query/Abstract.php
r4264 r4303 932 932 $query = $this->getSqlQuery($params); 933 933 } 934 $params = $this->convertEnums($params); 934 935 } else { 935 936 $query = $this->_view->getSelectSql(); 936 937 } 937 938 $params = $this->convertEnums($params);939 938 940 939 if ($this->isLimitSubqueryUsed() && -
branches/0.11/lib/Doctrine/View.php
r3884 r4303 53 53 * @var string $name the name of the view 54 54 */ 55 protected $ name;55 protected $_name; 56 56 57 57 /** 58 58 * @var Doctrine_Query $query the DQL query object this view is hooked into 59 59 */ 60 protected $ query;60 protected $_query; 61 61 62 62 /** 63 63 * @var Doctrine_Connection $conn the connection object 64 64 */ 65 protected $conn; 65 protected $_conn; 66 67 /** 68 * @var string $_dql The view dql string 69 */ 70 protected $_dql; 71 72 /** 73 * @var string $_sql The view sql string 74 */ 75 protected $_sql; 66 76 67 77 /** … … 72 82 public function __construct(Doctrine_Query $query, $viewName) 73 83 { 74 $this->name = $viewName; 75 $this->query = $query; 76 $this->query->setView($this); 77 $this->conn = $query->getConnection(); 84 $this->_name = $viewName; 85 $this->_query = $query; 86 $this->_query->setView($this); 87 $this->_conn = $query->getConnection(); 88 $this->_dql = $query->getDql(); 89 $this->_sql = $query->getSql(); 78 90 } 79 91 80 92 /** 81 * getQuery82 93 * returns the associated query object 83 94 * … … 86 97 public function getQuery() 87 98 { 88 return $this-> query;99 return $this->_query; 89 100 } 90 101 91 102 /** 92 * getName93 103 * returns the name of this view 94 104 * … … 97 107 public function getName() 98 108 { 99 return $this-> name;109 return $this->_name; 100 110 } 101 111 102 112 /** 103 * getConnection104 113 * returns the connection object 105 114 * … … 108 117 public function getConnection() 109 118 { 110 return $this-> conn;119 return $this->_conn; 111 120 } 112 121 113 122 /** 114 * create115 123 * creates this view 116 124 * … … 120 128 public function create() 121 129 { 122 $sql = sprintf(self::CREATE, $this-> name, $this->query->getQuery());130 $sql = sprintf(self::CREATE, $this->_name, $this->_query->getQuery()); 123 131 try { 124 $this-> conn->execute($sql);132 $this->_conn->execute($sql); 125 133 } catch(Doctrine_Exception $e) { 126 134 throw new Doctrine_View_Exception($e->__toString()); … … 129 137 130 138 /** 131 * drop132 139 * drops this view from the database 133 140 * … … 138 145 { 139 146 try { 140 $this-> conn->execute(sprintf(self::DROP, $this->name));147 $this->_conn->execute(sprintf(self::DROP, $this->_name)); 141 148 } catch(Doctrine_Exception $e) { 142 149 throw new Doctrine_View_Exception($e->__toString()); … … 145 152 146 153 /** 147 * execute148 * executes the view149 154 * returns a collection of Doctrine_Record objects 150 155 * … … 153 158 public function execute() 154 159 { 155 return $this-> query->execute();160 return $this->_query->execute(); 156 161 } 157 162 158 163 /** 159 * getSelectSql160 164 * returns the select sql for this view 161 165 * … … 164 168 public function getSelectSql() 165 169 { 166 return sprintf(self::SELECT, $this->name); 170 return sprintf(self::SELECT, $this->_name); 171 } 172 173 /** 174 * Get the view sql string 175 * 176 * @return string $sql 177 */ 178 public function getViewSql() 179 { 180 return $this->_sql; 181 } 182 183 /** 184 * Get the view dql string 185 * 186 * @return string $dql 187 */ 188 public function getViewDql() 189 { 190 return $this->_dql; 167 191 } 168 192 }