Issues (590)

src/Query/Contract/EntityJoinable.php (3 issues)

1
<?php
2
3
namespace Bdf\Prime\Query\Contract;
4
5
use Closure;
6
use LogicException;
7
8
/**
9
 * Interface for joinEntity() methods
10
 */
11
interface EntityJoinable extends Joinable, Whereable
12
{
13
    /**
14
     * Creates and adds a join to the query.
15
     *
16
     * <code>
17
     *     $query
18
     *         ->joinEntity('Namespace\\EntityClass', 'userId', 'id', 'entity')
19
     *         ->where('entity.name', ':like', 'seb%');
20
     * </code>
21
     *
22
     * @param class-string $entity
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string.
Loading history...
23
     * @param string|callable(\Bdf\Prime\Query\JoinClause):void $key
24
     * @param string|null $foreign
25
     * @param string|null $alias Alias is mandatory
26
     * @param Joinable::* $type Type of join.
27
     *
28
     * @return $this This Query instance.
29
     *
30
     * @throws LogicException  If alias is not set and $key is not a closure
31
     */
32
    public function joinEntity(string $entity, $key, ?string $foreign = null, string $alias = null, string $type = self::INNER_JOIN);
33
34
    /**
35
     * Creates and adds a join to the query.
36
     *
37
     * @param class-string $entity
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string.
Loading history...
38
     * @param string|callable(\Bdf\Prime\Query\JoinClause):void $key
39
     * @param string|null $foreign
40
     * @param string|null $alias
41
     *
42
     * @return $this This Query instance.
43
     */
44
    public function leftJoinEntity(string $entity, $key, ?string $foreign = null, string $alias = null);
45
46
    /**
47
     * Creates and adds a join to the query.
48
     *
49
     * @param class-string $entity
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string.
Loading history...
50
     * @param string|callable(\Bdf\Prime\Query\JoinClause):void $key
51
     * @param string|null $foreign
52
     * @param string|null $alias
53
     *
54
     * @return $this This Query instance.
55
     */
56
    public function rightJoinEntity(string $entity, $key, ?string $foreign = null, string $alias = null);
57
}
58