Laravel ORM 模块图


迁移自简书,格式可能未经校对。

还会更新,只是懒得整理,先堆这里了

image.png

PlatUML 代码:

@startuml

' 底层驱动部分
class DatabaseManager{
    connection() factory的大脑
}
class ConnectionFactory{
    newConnection()
}

interface Connection {
    defaultBuilder
    defaultGrammar
    defaultProcesser
    run()   // 真正到DB里跑SQL的
}
interface Connector {
    connect()
}

package Query|Schema {
    interface Grammar
    interface Processer
    note right of Processer: 对数据库返回值的二次拼装
    class QueryBuilder {
        IConnection
        IGrammar
        IProcesser

        paginate()
    }
}

DatabaseManager *--> ConnectionFactory
DatabaseManager *--> Connection
DatabaseManager *--> Connector

ConnectionFactory *--> Connection
ConnectionFactory *--> Connector

Connection --|> Grammar
Connection --|> Processer
QueryBuilder --|> Grammar
QueryBuilder --|> Processer

Connection -- QueryBuilder


' Eloquent
package Eloquent{
    abstract class Relation{
        Ebuilder

        constraints
    }
    class EBuilder{
        model
        scopes
        earerLoad
        macro

        first()
        has()
    }
    class model{
        scopes
        events

        __call()
        serialize()
    }
}

@enduml
Avatar
huiren
Code Artisan

问渠那得清如许,为有源头活水来

相关

下一页
上一页
comments powered by Disqus