/** * Returns a DQL expression that can be used to get a text representation of the given type of entities. * * @param string $className The FQCN of the entity * @param string $alias The alias in SELECT or JOIN statement * * @return string|false */ protected function getNameDQL($className, $alias) { $fields = $this->mapper->getEntityMapParameter($className, 'title_fields'); if ($fields) { $titleParts = []; foreach ($fields as $field) { $titleParts[] = $alias . '.' . $field; $titleParts[] = '\' \''; } return QueryUtils::buildConcatExpr($titleParts); } return false; }
/** * @dataProvider concatExprProvider * * @param string[] $parts * @param string $expectedExpr */ public function testBuildConcatExpr($parts, $expectedExpr) { $this->assertEquals($expectedExpr, QueryUtils::buildConcatExpr($parts)); }