Reputation: 29
I have a table "actions" with partitions
PARTITION BY RANGE (MONTH(`created_at`)) (
PARTITION `m1` VALUES LESS THAN (2),
PARTITION `m2` VALUES LESS THAN (3),
PARTITION `m3` VALUES LESS THAN (4),
PARTITION `m4` VALUES LESS THAN (5),
PARTITION `m5` VALUES LESS THAN (6),
PARTITION `m6` VALUES LESS THAN (7),
PARTITION `m7` VALUES LESS THAN (8),
PARTITION `m8` VALUES LESS THAN (9),
PARTITION `m9` VALUES LESS THAN (10),
PARTITION `m10` VALUES LESS THAN (11),
PARTITION `m11` VALUES LESS THAN (12),
PARTITION `m12` VALUES LESS THAN (13)
);
I want to select partitions in clause FROM:
SELECT t1.*
FROM actions PARTITION (m6, m7) as t1
WHERE t1.created_at >= NOW() - INTERVAL 14 DAY
(It is the MySql)
but I don't now how that add to Doctrine QueryBuilder
Upvotes: 0
Views: 880
Reputation: 87
only 2 things in doctrine can hook into the FROM
part - AST walker and Output walker. custom functions cannot.
imho in this case the best approach would be overriding SqlWalker::walkFromClause()
with conjuction of custom query hint.
Upvotes: 0
Reputation: 490
Doctrine does not support that in query builder. You either have to write native SQL or create custom DQL function.
Upvotes: 1