Discussion:
[Symfony2 - Beta2] Using camelCase table names in entities
polonese
2011-05-24 08:10:35 UTC
Permalink
Hey,

i tried to use camelCase table names in entities like:

------------------------------------------------------------------------------
/**
* @ORM\Table(name="postalCodes")
* @ORM\Entity
*/
class PostalCode{}
------------------------------------------------------------------------------

But if i run the following command in my cmd,

------------------------------------------------------------------------------
php app/console doctrine:schema:create
------------------------------------------------------------------------------

it will create a lowercase mysql-table "postalcodes".
Is this a doctrine bug?

camelCase columns are supported:

------------------------------------------------------------------------------
/**
* @ORM\Column(name="camelCase", type="string", length=255,
nullable=false)
*/
private $camelCase;
------------------------------------------------------------------------------

will create am mysql-column "camelCase"
--
If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users-/***@public.gmane.org
To unsubscribe from this group, send email to
symfony-users+unsubscribe-/***@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
Christophe COEVOET
2011-05-25 06:56:10 UTC
Permalink
Post by polonese
Hey,
------------------------------------------------------------------------------
/**
*/
class PostalCode{}
------------------------------------------------------------------------------
But if i run the following command in my cmd,
------------------------------------------------------------------------------
php app/console doctrine:schema:create
------------------------------------------------------------------------------
it will create a lowercase mysql-table "postalcodes".
Is this a doctrine bug?
------------------------------------------------------------------------------
/**
nullable=false)
*/
private $camelCase;
------------------------------------------------------------------------------
will create am mysql-column "camelCase"
It is not a Doctrine bug but your MySQL server is probably configured to
lowercase the table names (which is the default behavior for the Windows
versions of MySQL)
--
Christophe | Stof
--
If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users-/***@public.gmane.org
To unsubscribe from this group, send email to
symfony-users+unsubscribe-/***@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
Carl
2011-05-25 07:17:58 UTC
Permalink
If you want to ensure that table names remain constant in Windows and Linux
and not have to worry about the case of table names (e.g., you develop on a
Windows machine but your production server runs Linux), you can set
lower_case_table_names to 1 in the global my.cnf config file (Linux):

http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_lower_case_table_names

For example:

[mysqld]
# ...
lower_case_table_names = 1
# ...

I had the exact same issue and setting this variable fixed it for me. My
code worked fine in Windows but as soon as I put it on my production server,
none of my tables could be found due to the Linux version of MySQL being
case sensitive when it comes to table names.
--
If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users-/***@public.gmane.org
To unsubscribe from this group, send email to
symfony-users+unsubscribe-/***@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
Loading...