Propel3

高性能数据映射器ORM,具有RAD和现代PHP 7.1+的可选活动记录(active-record)特性。(High performance data-mapper ORM with optional active-record traits for RAD and modern PHP 7.1+.)

Github stars Tracking Chart

Propel3

Propel3是一款面向现代PHP 7.1+的开源对象关系映射(ORM)。

Propel ORM的版本3取代了 Propel2 ,这不再被维护。 Propel3引入了一个数据映射器实现,它将实体与实际的持久逻辑分开。

状态

目前处于开发中,尚未准备好使用。

特性

  • Propel速度非常快
  • 具有运行时UnitOfWork的数据映射器,具有大量对象计数的高性能(批量插入/更新)
  • 查询-生成器
  • 代码生成非常适合IDE
  • 生成所有列和关系的方法
  • 数据库模式迁移
  • 模式逆向工程
  • 定制
  • Propel带有常见的“行为”
  • 完全针对MySQL、PostgreSQL和SQLite进行单元测试。 Oracle和MSSQL是实验性的。

示例

定义实体

XML
 <database name="default">
  <entity name="Vendor\Car">
      <field name="id" primaryKey="true" autoIncrement="true" type="INTEGER" />
      <field name="name" type="VARCHAR" required="true"  />
      <relation target="Publisher" onDelete="setnull"/>
      <relation target="Author" onDelete="setnull" onUpdate="cascade"/>
  </entity>
</database>
或标注

在开发中。

namespace Vendor

use Propel\Annotations\Entity;
use Propel\Annotations\Field;
use Propel\Annotations\PrimaryKey;

/**
 * @Entity()
 */ 
class Car
{
    /**
     * @PrimaryKey(auto_increment=true)
     */
    private $id;
    
    /**
     * @Field(type="VARCHAR")
     */
    private $name;
    
    // getters/setters
}

数据映射器

$propel = new Propel\Runtime\Configuration('path/to/propel.yml');

// require a session for each request/workload
$session = $propel->getSession();

$car = new Vendor\Car();
$car->setName('Ford');

$session->persist($car);
$session->commit();

RAD/Active-record

// use <entity name="Vendor\Car" activeRecord="true">
$car = new Vendor\Car();
$car->setName('Ford');
$car->save();

安装

阅读 Propel文档。该文档仍然适用于Propel2。

贡献

每个人都可以为Propel做出贡献。只需将它分叉,并发送合并请求。 您必须遵循 PSR2 conding标准并尽可能提供单元测试。

请参阅我们的贡献指南。谢谢!

许可证

请参阅 LICENSE 文件。

Main metrics

Overview
Name With Ownerpropelorm/Propel3
Primary LanguagePHP
Program languageMakefile (Language Count: 7)
PlatformLinux, Mac, Windows
License:MIT License
所有者活动
Created At2017-01-03 15:57:34
Pushed At2020-07-17 16:57:25
Last Commit At2019-11-09 07:24:53
Release Count0
用户参与
Stargazers Count255
Watchers Count45
Fork Count36
Commits Count4k
Has Issues Enabled
Issues Count57
Issue Open Count23
Pull Requests Count33
Pull Requests Open Count2
Pull Requests Close Count3
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

Propel3

Propel3 is an open-source Object-Relational Mapping (ORM) for modern PHP 7.1+.

Build Status
Code Climate

PPM Compatible
Gitter

Version 3 of Propel ORM replaces Propel2, which is not maintained anymore.
Propel3 introduces a data-mapper implementation which separates your entities from the actual persisting logic.

Status

This is in current development and is not yet ready to use.

Features

  • Propel is blazing fast
  • Data mapper with runtime UnitOfWork for high performance with massive object counts (bulks inserts/updates)
  • Query-Builder
  • Very IDE friendly thanks to code-generation
  • Generation of methods for all columns and relations
  • Database schema migration
  • Schema reverse engineering
  • Customizable
  • Propel comes with common ‘behaviors’
  • Completely unit tested for MySQL, PostgreSQL, SQLite. Oracle and MSSQL are experimental.

Example

Define the entity

XML
<database name="default">
  <entity name="Vendor\Car">
      <field name="id" primaryKey="true" autoIncrement="true" type="INTEGER" />
      <field name="name" type="VARCHAR" required="true"  />
      <relation target="Publisher" onDelete="setnull"/>
      <relation target="Author" onDelete="setnull" onUpdate="cascade"/>
  </entity>
</database>
or annotations

In work.


namespace Vendor

use Propel\Annotations\Entity;
use Propel\Annotations\Field;
use Propel\Annotations\PrimaryKey;

/**
 * @Entity()
 */ 
class Car
{
    /**
     * @PrimaryKey(auto_increment=true)
     */
    private $id;
    
    /**
     * @Field(type="VARCHAR")
     */
    private $name;
    
    // getters/setters
}

Data mapper

$propel = new Propel\Runtime\Configuration('path/to/propel.yml');

// require a session for each request/workload
$session = $propel->getSession();

$car = new Vendor\Car();
$car->setName('Ford');

$session->persist($car);
$session->commit();

RAD/Active-record

// use <entity name="Vendor\Car" activeRecord="true">
$car = new Vendor\Car();
$car->setName('Ford');
$car->save();

Installation

Read the Propel documentation. This documentation is for Propel2 still.

Contribute

Everybody can contribute to Propel. Just fork it, and send Pull Requests.
You have to follow PSR2 coding standards and provides unit tests as much as possible.

Please see our contribution guideline. Thank you!

License

See the LICENSE file.