note 124261 deleted from function.join by cmb
| From: | cmb@php.net | Date: | Fri, 04 Oct 2019 14:37:30 +0000 |
| Subject: | note 124261 deleted from function.join by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212453@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
https://github.com/erdalceylan/array-join
{
"require": {
"erdalceylan/array-join": "2.0.0"
}
}
<?php
$instance = \ArrayJoin\Builder::newInstance()
->select("a.id", "a.nick", "b.item", "d.food")
->from($users, "a")
->innerJoin($items, "b", new \ArrayJoin\On("a.id = b.user_id"))
->leftJoin($texts, "c", new \ArrayJoin\On("a.id = c.user_id"))
->rightJoin($foods, "d", new \ArrayJoin\On("b.user_id = d.user_id"))
->where(function ($id, $text, $item, $food){
return $id < 50;
}, "a.id", "c.text", "b.item", "d.food")
->groupBy("a.id", "d.food")
->limit(2)
->offset(1)
->setFetchType(\ArrayJoin\Builder::FETCH_TYPE_OBJECT);
$instance->execute();
array (
stdClass::__set_state(array(
'id' => 1,
'nick' => 'erdal',
'item' => 'çorap',
'food' => 'iskender',
)),
stdClass::__set_state(array(
'id' => 1,
'nick' => 'erdal',
'item' => 'çorap',
'food' => 'iskender',
)),
);