Changeset 3673
- Timestamp:
- 01/29/08 23:19:20 (17 months ago)
- Files:
-
- 3 modified
-
branches/0.10/lib/Doctrine/Task/Dql.php (modified) (1 diff)
-
branches/0.9/lib/Doctrine/Task/Dql.php (modified) (1 diff)
-
trunk/lib/Doctrine/Task/Dql.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.10/lib/Doctrine/Task/Dql.php
r3672 r3673 37 37 'dql_query' => 'Specify the complete dql query to execute.'), 38 38 $optionalArguments = array(); 39 39 40 40 public function execute() 41 41 { 42 42 Doctrine::loadModels($this->getArgument('models_path')); 43 43 44 44 $dql = $this->getArgument('dql_query'); 45 45 46 46 $query = new Doctrine_Query(); 47 48 $this->notify('executing: "' . $dql . '"'); 49 50 $results = $query->query($dql); 51 47 48 $params = explode(',', $this->getArgument('params')); 49 50 $this->notify('executing: "' . $dql . '" (' . implode(', ', $params) . ')'); 51 52 $results = $query->query($dql, $params); 53 52 54 $this->_printResults($results); 53 55 } 54 56 55 57 protected function _printResults($data) 56 58 { 57 59 $array = $data->toArray(true); 58 60 59 61 $yaml = Doctrine_Parser::dump($array, 'yml'); 60 62 $lines = explode("\n", $yaml); 61 63 62 64 unset($lines[0]); 63 65 $lines[1] = $data->getTable()->getOption('name') . ':'; 64 66 65 67 foreach ($lines as $yamlLine) { 66 68 $line = trim($yamlLine); 67 69 68 70 if ($line) { 69 71 $this->notify($yamlLine); -
branches/0.9/lib/Doctrine/Task/Dql.php
r3672 r3673 41 41 { 42 42 Doctrine::loadModels($this->getArgument('models_path')); 43 43 44 44 $dql = $this->getArgument('dql_query'); 45 45 46 46 $query = new Doctrine_Query(); 47 48 $this->notify('executing: "' . $dql . '"'); 49 50 $results = $query->query($dql); 51 47 48 $params = explode(',', $this->getArgument('params')); 49 50 $this->notify('executing: "' . $dql . '" (' . implode(', ', $params) . ')'); 51 52 $results = $query->query($dql, $params); 53 52 54 $this->_printResults($results); 53 55 } 54 56 55 57 protected function _printResults($data) 56 58 { 57 59 $array = $data->toArray(true); 58 60 59 61 $yaml = Doctrine_Parser::dump($array, 'yml'); 60 62 $lines = explode("\n", $yaml); 61 63 62 64 unset($lines[0]); 63 65 $lines[1] = $data->getTable()->getOption('name') . ':'; 64 66 65 67 foreach ($lines as $yamlLine) { 66 68 $line = trim($yamlLine); 67 69 68 70 if ($line) { 69 71 $this->notify($yamlLine); -
trunk/lib/Doctrine/Task/Dql.php
r3624 r3673 49 49 50 50 $this->notify('executing: "' . $dql . '" (' . implode(', ', $params) . ')'); 51 51 52 52 $results = $query->query($dql, $params); 53 53