本文整理汇总了PHP中QueryBuilder::join方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::join方法的具体用法?PHP QueryBuilder::join怎么用?PHP QueryBuilder::join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::join方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mergeJoinInto
/**
* Merge this QueryBuilder's JOINs into the given QueryBuilder.
*
* @param QueryBuilder $QueryBuilder to merge into
* @return QueryBuilder
*/
public function mergeJoinInto(QueryBuilder $QueryBuilder)
{
foreach ($this->join as $currentJoin) {
$QueryBuilder->join($currentJoin['table'], $currentJoin['criteria'], $currentJoin['type'], $currentJoin['alias']);
}
return $QueryBuilder;
}
示例2: testJoin5
/**
* Generated from @assert join('user U', 'INNER', array(array('U.id', 'A.id'), array('U.id', 'A.id')))->text() [==] " INNER JOIN `user` AS U ON U.`id` = A.`id` AND U.`id` = A.`id`".
*
* @covers Kotchasan\Database\QueryBuilder::join
*/
public function testJoin5()
{
$this->assertEquals(" INNER JOIN `user` AS U ON U.`id` = A.`id` AND U.`id` = A.`id`", $this->object->join('user U', 'INNER', array(array('U.id', 'A.id'), array('U.id', 'A.id')))->text());
}
示例3: define
require_once 'libs/Bootstrap.php';
require_once 'libs/QueryBuilder.php';
// Authentication token
$token = $peregrine->session->getUsername('username') . $peregrine->server->getRaw('REMOTE_ADDR');
if (!$auth->checkToken($token, $peregrine->session->getRaw('token'))) {
exit;
}
if (!defined('MYSQL_PREFIX')) {
define('MYSQL_PREFIX', 'prism_');
// Old config files may not have the constant defined yet.
}
// Build query
$qb = new QueryBuilder();
$qb->select('id, epoch, action, player, world, x, y, z, block_id, block_subid, old_block_id, old_block_subid, data');
$qb->from(MYSQL_PREFIX . 'data', 'd');
$qb->join('INNER JOIN ' . MYSQL_PREFIX . 'players p ON p.player_id = d.player_id');
$qb->join('INNER JOIN ' . MYSQL_PREFIX . 'actions a ON a.action_id = d.action_id');
$qb->join('INNER JOIN ' . MYSQL_PREFIX . 'worlds w ON w.world_id = d.world_id');
$qb->join('LEFT JOIN ' . MYSQL_PREFIX . 'data_extra ex ON ex.data_id = d.id');
// World
if (!$peregrine->post->isEmpty('world')) {
$world = explode(",", $peregrine->post->getUsername('world'));
$qb->where(QueryBuilder::buildOrQuery('w.world', $world));
}
// Coordinates
if (!$peregrine->post->isEmpty('x', false, false) && !$peregrine->post->isInt('y', false, false) && !$peregrine->post->isInt('z', false, false)) {
$x = $peregrine->post->getInt('x');
$y = $peregrine->post->getInt('y');
$z = $peregrine->post->getInt('z');
if (!$peregrine->post->isInt('radius', false, false)) {
$radius = $peregrine->post->getInt('radius');