How to get the names of all columns in a doctrine entity?
As described in the documentation for ClassMetadataInfo you can use the getColumnNames
method:
$em->getClassMetadata('Entities\MyEntity')->getColumnNames();
-
6That's not the column name, it's the property name.. should be ->getColumnNames() instead – jj-aa Jun 9 '16 at 14:28
-
2This answer is not complete you dont have the foreign key and the discriminator. see my answer stackoverflow.com/questions/31827554/… – Guillaume Alouege Mar 20 '17 at 16:33