Chapters
29 Chapters
|
1:34:37
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!Compatible PHP versions: >=5.3.3
Subscribe to download the code!Compatible PHP versions: >=5.3.3
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
11.
Creating a Custom orderBy Query
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4", // v2.4.2
"doctrine/orm": "~2.2,>=2.2.3", // v2.4.2
"doctrine/doctrine-bundle": "~1.2", // v1.2.0
"twig/extensions": "~1.0", // v1.0.1
"symfony/assetic-bundle": "~2.3", // v2.3.0
"symfony/swiftmailer-bundle": "~2.3", // v2.3.5
"symfony/monolog-bundle": "~2.4", // v2.5.0
"sensio/distribution-bundle": "~2.3", // v2.3.4
"sensio/framework-extra-bundle": "~3.0", // v3.0.0
"sensio/generator-bundle": "~2.3", // v2.3.4
"incenteev/composer-parameter-handler": "~2.0", // v2.1.0
"doctrine/doctrine-fixtures-bundle": "~2.2.0", // v2.2.0
"ircmaxell/password-compat": "~1.0.3", // 1.0.3
"phpunit/phpunit": "~4.1", // 4.1.0
"stof/doctrine-extensions-bundle": "~1.1.0" // v1.1.0
}
}
6 Comments
Hi Ryan,
How can I call a stored procedure in MSSQL database? Connection between my Symfony v2.6 and SQL Server 2008R2 has been established, and I can do some basics.
Ryan,
I'm sorry. I've found the answer. I should have just execute the stored procedure in the same way as I run in the SQL management studio.
Error I was getting was because of the permission issue. The passing credentials running Symfony to the Linked Server was not right user.
I'm using getEntityManager(), and Symfony says is deprecated since v2.1. Can you tell me the current method I should use for plain SQL query?
===
$conn = $container->get('doctrine')->getEntityManager()->getConnection();
$sql = 'SELECT * FROM yoda_event';
$stmt = $conn->prepare($sql);
$stmt->execute();
var_dump($stmt->fetchAll());die;
===
Hey!
Thanks for posting the solution to your question here for others :).
About getEntityManager() being deprecated, just use getManger() instead - it returns the same exact thing (so nothing else needs to change) - we just renamed the method in 2.1.
Cheers!
getManager() work. Thanks Ryan. :-)
Hi everyone,
I can run a stored procedure or just plain query from my Symfony 2.6. I've written a stored procedure that calls another stored procedure that interacts with a historian. It looks the historian wants me provide a domain user. I can't make it work.
Do you know how I can use Windows domain user (my web server is IIS 7.5) as my database (pdo_sqlsrv) access credential?
I tried empty username/password and domain\user_account & password in the parameters without changing anything. It looks it's working.
Hi there!
I'll admit, I don't know anything about Windows and SQL server stuff :). But I will say that the stuff in parameters.yml (which is just being passed to the doctrine.dbal key in app/config/config.yml) is passed to the constructor of Doctrine Connection object: http://doctrine-dbal.readth.... So, if you're a bit brave, you might be able to debug it there. Also, in config.yml, here is the valid config you can put, in addition to dbname, password, etc: http://symfony.com/doc/curr... (look under doctrine.dbal.connections.default - all the keys you see there are valid for you to use).
I hope that helps, at least a little :).
Cheers!
"Houston: no signs of life"
Start the conversation!