Skip to content

BETWEEN operator in has() relation filter #128

Description

@olaulau

Hi ;

The BETWEEN operator doesn't seem to work in a has() relation filter :

$entity->has("service", ["date BETWEEN ? AND ?", "2024-02-01", "2024-02-29"]); // error
$entity->has("service", ["? <= date AND date <= ?", "2024-02-01", "2024-02-29"]); // works

$result = $entity->find(["pupil_id = ?", 12], []);

I get this error :

500 Internal Server Error
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '[table][rel_field].BETWEEN '2024-02-01' AND '2024-02-29')' at line 1 [[project_path]/vendor/bcosca/fatfree-core/db/sql.php:230]

of course, the same filter directly on the sub-entity work well :
$res2 = $entity2->find(["date BETWEEN ? AND ?", "2024-02-01", "2024-02-29"]);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions