Db::getColumnsByType()
\nn\t3::Db()->getColumnsByType($table = '', $colType = '', $useSchemaManager = false);
Get fields of a table by a specific type
\nn\t3::Db()->getColumnsByType( 'tx_news_domain_model_news', 'slug' );
Copied!
@param string $table
@param string $colType
@param boolean $useSchemaManager
@return array
Source Code
public function getColumnsByType( $table = '', $colType = '', $useSchemaManager = false )
{
$cols = $this->getColumns( $table, $useSchemaManager );
$results = [];
foreach ($cols as $fieldName=>$col) {
$type = $col['config']['type'] ?? false;
$fieldName = GeneralUtility::camelCaseToLowerCaseUnderscored( $fieldName );
if ($type == $colType) {
$results[$fieldName] = array_merge(['fieldName'=>$fieldName], $col);
}
}
return $results;
}
Copied!