Attempting to do a join with a LIKE operand in a Views filter plugin. The query looks similar to below; however, when it executes, the LIKE operand is not taken into account and the join is done with '='. Is there a way to do this type of join?

$configuration = [
     'type' => 'INNER',
     'table' => 'path_alias',
     'field' => 'CONCAT(\'%\', path_alias.path)',
     'left_table' => 'redirect',
     'left_field' => 'redirect_redirect__uri',
     'operator' => 'LIKE',];

   $join = Views::pluginManager('join')->createInstance('standard', $configuration);
   $this->query->addRelationship('path', $join, 'path_alias');

This is the query we are trying to execute:

FROM redirect AS redirect
INNER JOIN path_alias AS path ON 
  redirect.redirect_redirect__uri LIKE CONCAT('%', path.path);

There is a patch available that provides a solution to this problem: https://www.drupal.org/project/redirect/issues/2981544.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.