CodeIgniter 4.1のDatabase Query関連のクラス図 post

CodeIgniter 4.1.1のDatabase Query関連のクラスを理解するために、クラス図を書きましたので、残しておきます。

(2021/02/24追記) クラス図を更新しました。

クラス図

UML

@startuml

interface ConnectionInterface {
    BaseBuilder : table($tableName)
    query(string $sql, $binds)
}

abstract class BaseConnection implements ConnectionInterface {
    #$lastQuery
    query(string $sql, $binds, ...)
    #execute(string $sql)
}

BaseConnection ..> Query : create

class SQLite3\Connection extends BaseConnection {
    bool : isWriteType()
    execute(string $sql)
}

interface QueryInterface {
    bool : isWriteType()
}

class Query implements QueryInterface
{
    bool : isWriteType()
}

Query o-- ConnectionInterface

class Postgre\Query extends Query {
    bool : isWriteType()
}
note right of Postgre\Query : This is just an example.\nIt doesn't exist yet.

class BaseBuilder {
    #$db : ConnectionInterface
    string : compileFinalQuery()
}

BaseBuilder <.. ConnectionInterface : create
BaseBuilder ..> Query : create

interface PreparedQueryInterface {
    prepare(string $sql, array $options)
    execute(...$data)
}

abstract class BasePreparedQuery implements PreparedQueryInterface {
    #$query : Query
    #$db : BaseConnection
    prepare(string $sql, array $options, string $queryClass)
    execute(...$data)
}

BasePreparedQuery ..> Query : create

@enduml

Date: 2021/02/20

Tags: codeigniter, codeigniter4, database