Menu

## JoinContract

JoinContract.php : 9

### Table of Contents

#### Properties

$defaultJoinType : JoinType
$joinAliases : array<string|int, mixed>|null
$joins : array<string|int, mixed>|null
$joinTypes : array<string|int, mixed>|null

#### Methods

attachJoins() : Join
  Attaches all defined joins to the base query.
getAllItemsJoined() : array<string|int, mixed>
  Will be used when we are listing everything.
getOneJoined() : object|null
  Will be used when we are getting a single item.
joinQuery() : Join
  Resolve the base query to base on to start joining.
switchJoin() : Join
weShouldJoin() : bool
  Detects whether to enter to enter the join mode or stay in the normal mode.

### Properties

#### $defaultJoinType

JoinContract.php : 72
`public JoinType $defaultJoinType = \Pionia\Http\Services\JoinType::INNER`

The default join type to use when joining tables.

#### $joinAliases

JoinContract.php : 51
`public array<string|int, mixed>|null $joinAliases = null`

An associative array of aliases to be used for joins with the table in the service. The key is the table name and the value is the alias.

##### Tags

example

      [
         'student' => 's',
      ]

  This will join the `student` table using the alias `s`.

#### $joins

JoinContract.php : 23
`public array<string|int, mixed>|null $joins = null`

An associative array of tables to be used for joins with the table in the service. The key is the table name and the value is an array of the columns to join on.

##### Tags

example

      [
         'student' => ['id' => 'student_id'],
      ]

  This will join the `student` table on the `id` column of the current table and the `student_id` column of the `student` table.

#### $joinTypes

JoinContract.php : 37
`public array<string|int, mixed>|null $joinTypes = null`

An associative array of join types to be used for joins with the table in the service. The key is the table name and the value is the join type.

##### Tags

example

      [
         'student' => JoinType::INNER,
      ]

  This will join the `student` table using an inner join.

### Methods

#### attachJoins()

JoinContract.php : 157

Attaches all defined joins to the base query.

`private attachJoins([Join|null $join = null ]) : Join`

##### Parameters

$join : Join|null = null

##### Tags

throws
  Exception

##### Return values

Join

#### getAllItemsJoined()

JoinContract.php : 141

Will be used when we are listing everything.

`private getAllItemsJoined() : array<string|int, mixed>`

##### Tags

throws
  Exception

##### Return values

array<string|int, mixed>

#### getOneJoined()

JoinContract.php : 125

Will be used when we are getting a single item.

`private getOneJoined() : object|null`

##### Tags

throws
  Exception

##### Return values

object|null

#### joinQuery()

JoinContract.php : 205

Resolve the base query to base on to start joining.

`private joinQuery() : Join`

If the developer has not yet defined any joins, we drop it and generate a new one.

##### Tags

throws
  Exception

##### Return values

Join

#### switchJoin()

JoinContract.php : 180
`private switchJoin(JoinType $joinType, Join $query, string $table) : Join`

##### Parameters

$joinType : JoinType

  The type of join to use

$query : Join

  The current query we are joining to

$table : string

  The table to join

##### Return values

Join —

The query with the join added

#### weShouldJoin()

JoinContract.php : 78

Detects whether to enter to enter the join mode or stay in the normal mode.

`private weShouldJoin() : bool`

Normal mode queries one table at a time.

##### Return values

bool

## Search results