hfw / db
Database CRUD by annotation
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/hfw/db
Requires
- php: ~7.4
- ext-pdo: *
This package is auto-updated.
Last update: 2025-10-08 11:50:12 UTC
README
Database storage and access using annotations.
Documentation: https://hfw.github.io/db
Class Annotations
/**
* @record my_table
*/
class MyClass implements Helix\DB\EntityInterface, ArrayAccess {
use Helix\DB\AttributesTrait;
/**
* "id" is a required column.
* @column
* @var int
*/
protected $id = 0;
/**
* @column
* @var string
*/
protected $myColumn;
/**
* @eav foo_eav
* @var array
*/
protected $attributes;
/**
* @return int
*/
final public function getId() {
return $this->id;
}
}
- Columns must be named the same as their respective properties.
- EAV tables must have 3 columns:
entity
,attribute
, andvalue
.entity
must be a foreign key.entity
andattribute
must form the primary key.
Interface Annotations
Interfaces can be annotated to act as junctions.
/**
* @junction foo_bar
* @foreign foo_id Foo
* @foreign bar_id Bar
*/
interface FooBar { }
- The interfaces don't have to be implemented.
- The referenced classes may be identical.
Supported Drivers
- MySQL
- SQLite