chenjiahao/swoft-orm

swoft orm laravel orm

v4.0 2020-03-18 01:18 UTC

This package is not auto-updated.

Last update: 2024-04-10 20:42:08 UTC


README

兼容laravel的orm

namespace App\Model; use cjhswoftOrm\Model;

class A extends Model { /** * The table associated with the model. * * @var string */ protected $table = 'aaa';

protected $primaryKey =  'id';

protected $connection = 'db.pool';
  
public $timestamps = false;

/**
 * @var array
 */
protected $fillable = ['a','b','c'];

}

    \cjhswoftOrm\ConnectionFactory:: connection( 'db.pool')->transaction (function(){
    	
    $a =  new \App\Model\A();
    $a->a=1;
    $a->b=1;
    $a->c=1;
    $a->save();
    
    
  
    
    $a =  new \App\Model\A();
    $a->a=1;
    $a->b=1;
    $a->c=1;
    $a->save();  
    
    });