GEMVC Documentation

Complete guide to building modern, secure PHP applications with GEMVC framework

Database Architecture

Directory Structure

src/database/
├── AbstractDatabasePool.php    # Base abstract class for pool management
# ... (rest of the directory structure)
└── model/                     # Model layer - business logic + multi-table operations
    ├── UserModel.php          # User business logic (extends UserTable)
    ├── OrderModel.php         # Order business logic (extends OrderTable)
    └── ProductModel.php       # Product business logic (extends ProductTable)

Database Architecture Layers

The database system follows a clean two-layer architecture with lazy loading throughout:

Model Layer (Business Logic + Multi-Table Operations)
    ↓ (extends)
Table Layer (Single Database Table + Properties)
    ↓ (extends)
Base Table (Core Database Functionality)
    ↓ (composition with lazy loading)
PdoQuery → QueryExecuter → DatabasePoolFactory → Connection Pools

Database Layer Responsibilities

1. Model Layer: Business logic, validation, multi-table operations, relationships

2. Table Layer: Single database table representation, table-specific operations

Next Steps