mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-373: Improper use of ternary operator in EntityManager::create() #464
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Feb 25, 2010).
Jira issue originally created by user susokary:
It seems to me that you make an improper use of ternary operator in EntityManager::create() since revision #6226.
In last revision available, you can see, line #605 of lib/Doctrine/ORM/EntityManager.php, this instruction : $config = $config ?: new Configuration();
Instead of, I guess, this one : $config = $config ? $config : new Configuration();
What do you think ?
@doctrinebot commented on GitHub (Feb 25, 2010):
Comment created by jnye:
"Since PHP 5.3, it is possible to leave out the middle part of the ternary operator. Expression expr1 ?: expr3 returns expr1 if expr1 evaluates to TRUE, and expr3 otherwise." -- http://www.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary
@doctrinebot commented on GitHub (Feb 25, 2010):
Comment created by susokary:
You're totally right !
Thanks for your quick answer.
But, since there, I don't understand why modifying this line gave us a benefit, while we're currently using PHP 5.3.3-dev.
jpierre@jpierre-desktop:/$ php -v
PHP 5.3.3-dev (cli) (built: Feb 12 2010 00:10:46)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0beta3-dev, Copyright (c) 2002-2010, by Derick Rethans
The fact is that, before rewriting this instruction, it was impossible for us to get a "doctrine.orm.manager" service in our Symfony 2 controller created according to this tutorial : http://www.noelguilbert.com/?post/2010/02/21/Utiliser-Doctrine-2-avec-Symfony
We need to dig this strange situation.
Thanks for your help.
Greetings from France.
Jérôme.
@doctrinebot commented on GitHub (Mar 5, 2010):
Comment created by romanb:
$config = $config ?: new Configuration();
and
$config = $config ? $config : new Configuration();
is exactly the same thing. Your problem must have been caused by something else.
@doctrinebot commented on GitHub (Mar 5, 2010):
Issue was closed with resolution "Invalid"