سؤال

I'm passing in an array of column names to a function in Propel, and I want to confirm that they are valid column names before running them in the database. The BasePeer classes have consts that do the reverse of this, getting the string representation of a column name.

هل كانت مفيدة؟

المحلول

You can use the generate TableMap class to check if a column exists.

Basically, all table/object information are stored there.

Propel2

(boolean) <ObjectPhpName>TableMap::getTableMap()->hasColumn('columnName')

In Propel 1.x its:

(boolean) <ObjectPhpName>Peer::getTableMap()->hasColumn('columnName')
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top