Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
ddefc7f9
Commit
ddefc7f9
authored
Jan 25, 2008
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to sandbox and added printing of params to output of dql task.
parent
00195ebb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
Dql.php
lib/Doctrine/Task/Dql.php
+15
-13
config.php
tools/sandbox/config.php
+1
-1
No files found.
lib/Doctrine/Task/Dql.php
View file @
ddefc7f9
...
...
@@ -36,38 +36,40 @@ class Doctrine_Task_Dql extends Doctrine_Task
$requiredArguments
=
array
(
'models_path'
=>
'Specify path to your Doctrine_Record definitions.'
,
'dql_query'
=>
'Specify the complete dql query to execute.'
),
$optionalArguments
=
array
(
'params'
=>
'Comma separated list of the params to replace the ? tokens in the dql'
);
public
function
execute
()
{
Doctrine
::
loadModels
(
$this
->
getArgument
(
'models_path'
));
$dql
=
$this
->
getArgument
(
'dql_query'
);
$query
=
new
Doctrine_Query
();
$params
=
explode
(
','
,
$this
->
getArgument
(
'params'
));
$this
->
notify
(
'executing: "'
.
$dql
.
'" ('
.
implode
(
', '
,
$params
)
.
')'
);
$this
->
notify
(
'executing: "'
.
$dql
.
'"'
);
$results
=
$query
->
query
(
$dql
,
explode
(
','
,
$this
->
getArgument
(
'params'
)));
$results
=
$query
->
query
(
$dql
,
$params
);
$this
->
printResults
(
$results
);
}
protected
function
printResults
(
$data
)
{
$array
=
$data
->
toArray
(
true
);
$yaml
=
Doctrine_Parser
::
dump
(
$array
,
'yml'
);
$lines
=
explode
(
"
\n
"
,
$yaml
);
unset
(
$lines
[
0
]);
$lines
[
1
]
=
$data
->
getTable
()
->
getOption
(
'name'
)
.
':'
;
foreach
(
$lines
as
$yamlLine
)
{
$line
=
trim
(
$yamlLine
);
if
(
$line
)
{
$this
->
notify
(
$yamlLine
);
}
}
}
}
\ No newline at end of file
}
tools/sandbox/config.php
View file @
ddefc7f9
...
...
@@ -50,4 +50,4 @@ spl_autoload_register(array('Doctrine', 'autoload'));
Doctrine_Manager
::
connection
(
DSN
,
'sandbox'
);
Doctrine_Manager
::
getInstance
()
->
setAttribute
(
Doctrine
::
ATTR_MODEL_LOADING
,
Doctrine
::
MODEL_LOADING_CONSERVATIVE
);
\ No newline at end of file
Doctrine_Manager
::
getInstance
()
->
setAttribute
(
Doctrine
::
ATTR_MODEL_LOADING
,
Doctrine
::
MODEL_LOADING_CONSERVATIVE
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment