- Notifications
You must be signed in to change notification settings - Fork1
MySQL ORM library with Database First model that lets you create Entities with complex relationships and queries.
License
GregaMohorko/BlueDB
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A PHP MySQL ORM library with Database First model that lets you create Entities with base properties and complex relationships (One-To-Many,Many-To-One,Many-To-Many,Table Inheritance,Associative tables), supports queries with expressions, JSON encoding/decoding and is simple to use.
Check theBlueDBClient.NET for a .NET client library to use on the .NET client side.
You can read the documentation and tutorials under theWiki.
Let's assume that we have an entityUser.
Loading all entries:
$all = User::loadList();
This would load all entries with all fields.
Let's say that we want only theUsername fields:
$all = User::loadList([User::UsernameField]);
How about loading only those users, whoseUsername starts with "Ja"?
Simple, we use theCriteria
class:
$criteria =newCriteria(User::class);$criteria->add(Expression::startsWith(User::class, User::UsernameField,"Ja"));$results = User::loadListByCriteria($criteria);
Encoding/decoding entities to/from JSON? No problem!
$json =JSON::encode($entity);$entity =JSON::decode($json);
Creating a new entry:
$gordon =newUser();$gordon->Username ="Gordon";User::save($gordon);
Updating entries:
// let's change Gordons username to 'Freeman'$gordon->Username ="Freeman";User::update($gordon);
Deleting entries:
// let's delete GordonUser::delete($gordon);
These short examples are just the top of the iceberg, BlueDB has many many more cool features. To find them out and for more complex examples & tutorials, please go toWiki.
PHP version >= 5.5
Gregor Mohorko (www.mohorko.info)
Copyright (c) 2022 Gregor Mohorko
About
MySQL ORM library with Database First model that lets you create Entities with complex relationships and queries.