csrdelft / orm Goto Github PK
View Code? Open in Web Editor NEWThe creatively named object-relational mapping library for csrdelft.nl
Home Page: https://csrdelft.github.io/orm/
License: MIT License
The creatively named object-relational mapping library for csrdelft.nl
Home Page: https://csrdelft.github.io/orm/
License: MIT License
For some reason Trusty on Travis doesn't work.
Make the framework understand foreign keys.
Packagist requires us to choose a license (or mark as proprietary) in order for further updates to process.
License "Unknown" is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.
If the software is closed-source, you may use "proprietary" as license.
Add the option to save a simple PHP object into the database. For instance creating a simple Email
object which can only contain a valid email address.
Such class would look something like the following:
class Email extends PersistenceObject {
/** @var string **/
protected $email;
/**
* @param string $email;
*/
public function __construct($email) {
$this->assertValidEmail($email);
$this->email = $email;
}
public function getValue() {
return $this->email;
}
}
abstract class PersistenceObject {
abstract public function __construct($value);
abstract public function getValue();
}
The objects should require one required constructor argument and implement the getValue
method.
When defining a model the definition would look something like:
protected static $persistent_attributes = [
'email' => [T::Object, true, Email::class],
];
Or just, where the orm checks if the type is instantiable (subclass of PersistenceObject
)
protected static $persistent_attributes = [
'email' => [Email::class],
];
Integrate with Doctrine to help https://github.com/csrdelft/csrdelft.nl to migrate.
There is no validation whatsoever in this method, there should be, this can help catch bugs easier.
Number of primary keys should be validated.
Table part in uuid should be validated.
With csrdelft/csrdelft.nl running on PHP 7.0 we can move this project to PHP 7 too.
New stuff to use in PHP 7
It is currently not possible to set a default value for a column in the database. There is a check in place in https://github.com/csrdelft/orm/blob/master/src/Persistence/DatabaseAdmin.php#L159 which checks the database for the default value. The default value is always null according to the orm.
PersistentAttribute
already has some logic for supporting default values, reading from the class is not available yet.
Make it possible to create joins in sql to retrieve a bunch of data at once.
With MySql SAVEPOINT
s it is possible to create multilevel database transactions.
After setting a savepoint you can rollback to that savepoint while you are still in a transaction.
This is no longer supposed to be the case since onAttributesRetrieved
was implemented:
orm/src/Entity/PersistentEntity.php
Line 162 in 82b699c
In spirit of DynamicEntity it would load the list of options from the database and act like PersistentEnum.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.