瀏覽代碼

First steps to fix the softdelete issue

ahwelp 2 年之前
父節點
當前提交
2bfd6ec104
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/ORM/Entity.php

+ 3 - 3
src/ORM/Entity.php

@@ -210,7 +210,7 @@ abstract class Entity {
     }
 
     public function delete() {
-        if (isset($this->_softdelete) && $this->_softdelete) {
+        if (static::_softdelete) {
             $this->deleted_at = date('Y-m-d h:m:s');
             $this->update();
         }else{
@@ -595,8 +595,8 @@ abstract class Entity {
      * @param Array $remote_filter Filters to the remote Array('id', Array('>', 50) )
      * @param Array $pivot_limits Array( 'offset'=> 10, 'limit' => 10 )
      */
-    protected function belongsToManyExtended($foreignObject, $pivot_table, $local_in_pivot, $remote_in_pivot, $remote_filter = Array(), $pivot_limit = Array()) {
-        return new BelongsToManyExtended($this, $foreignObject, $pivot_table, $local_in_pivot, $remote_in_pivot, $remote_filter, $pivot_limit);
+    protected function belongsToManyExtended($foreignObject, $pivot_table, $local_in_pivot, $remote_in_pivot, $remote_filter = Array(), $pivot_limit = Array(), $softDelete = true) {
+        return new BelongsToManyExtended($this, $foreignObject, $pivot_table, $local_in_pivot, $remote_in_pivot, $remote_filter, $pivot_limit, $softDelete);
     }
 
     /**