Oihana PHP

Model uses DebugTrait, ToStringTrait

A base model class that integrates a PDO instance with dependency injection container support.

This class uses the PDOTrait to provide PDO-related database operations, binding, and fetching.

The model can be initialized with configuration options such as alters, binds, schema, defer assignment, logger, mock objects, and the PDO instance itself.

Tags
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Properties

$container  : Container
The DI container reference.

Methods

__construct()  : mixed
Creates a new Model instance.

Properties

$container

The DI container reference.

public Container $container

Methods

__construct()

Creates a new Model instance.

public __construct(Container $container[, LoggerInterface|string|null, mock: bool|null} $init = [] ]) : mixed
Parameters
$container : Container

The DI container to retrieve services like PDO and logger.

$init : LoggerInterface|string|null, mock: bool|null} = []

Optional initialization array with keys:

  • debug : Indicates if the debug mode is active (Default false).
  • logger : The optional PSR3 LoggerInterface reference or the name of the reference in the DI Container.
  • mock : Indicates if the model use a mock process (Default false).
Tags
throws
ContainerExceptionInterface

If container service retrieval fails.

NotFoundExceptionInterface

If container service not found.

On this page

Search results