var_dump(array(
'sql_query' => sprintf(
str_replace('?', '%s', $q->getSqlQuery()),
$parameter1, $parameter2, $parameter3
)
));
Friday, June 4, 2010
Debugging queries with symfony, doctrine and sprintf
Sometimes it is useful to see what parameters were passed to a query, using getSqlQuery we get the query with question marks and its annoying to then grab the query and play around with it... below is a quick fix for this problem, this purely a technique to save development time and you shouldn't leave var_dumps in your production code :)
Thursday, June 3, 2010
Filtering JavaScript Arrays
Below is an example of how you can filter a JavaScript array using jQuery
var foo = new Array(5);
foo[0] = "zero";
foo[1] = "one";
foo[2] = "two";
foo[3] = "three";
foo[4] = "four";
alert(foo);
fooSelected = jQuery.grep(foo, function(value) {
return value != "three";
} );
alert(fooSelected);
Subscribe to:
Posts (Atom)