From 9e2c84dd548b51418a7c002c29cccc7191a1c57b Mon Sep 17 00:00:00 2001 From: wuyanwen Date: Mon, 13 Jan 2020 16:22:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Equery=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/CatchQuery.php | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 extend/catcher/CatchQuery.php diff --git a/extend/catcher/CatchQuery.php b/extend/catcher/CatchQuery.php new file mode 100644 index 0000000..117936a --- /dev/null +++ b/extend/catcher/CatchQuery.php @@ -0,0 +1,52 @@ +getTable(); + + return $this->join($table, sprintf('%s.%s=%s.%s', $table, $joinField, $this->getTable(), $currentJoinField), $type, $bind); + } + + /** + * + * @time 2020年01月13日 + * @param string $model + * @param string $joinField + * @param string $currentJoinField + * @param array $bind + * @return CatchQuery + */ + public function catchLeftJoin(string $model, string $joinField, string $currentJoinField, array $bind = []) + { + return $this->catchJoin($model, $joinField, $currentJoinField, 'LEFT', $bind); + } + + /** + * + * @time 2020年01月13日 + * @param string $model + * @param string $joinField + * @param string $currentJoinField + * @param array $bind + * @return CatchQuery + */ + public function catchRightJoin(string $model, string $joinField, string $currentJoinField, array $bind = []) + { + return $this->catchJoin($model, $joinField, $currentJoinField, 'RIGHT', $bind); + } +}