Move models to proper ProcessMaker Model namespace.
This commit is contained in:
committed by
Paula Quispe
parent
6b8065a98f
commit
9aec728509
10
workflow/engine/src/ProcessMaker/Model/Application.php
Normal file
10
workflow/engine/src/ProcessMaker/Model/Application.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Application extends Model
|
||||
{
|
||||
protected $table = "APPLICATION";
|
||||
}
|
||||
42
workflow/engine/src/ProcessMaker/Model/Delegation.php
Normal file
42
workflow/engine/src/ProcessMaker/Model/Delegation.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Delegation extends Model
|
||||
{
|
||||
protected $table = "APP_DELEGATION";
|
||||
|
||||
/**
|
||||
* Returns the application this delegation belongs to
|
||||
*/
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo(Application::class, 'APP_UID', 'APP_UID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user this delegation belongs to
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'USR_ID', 'USR_ID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the process task this belongs to
|
||||
*/
|
||||
public function task()
|
||||
{
|
||||
return $this->belongsTo(Task::class, 'TAS_ID', 'TAS_ID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the process this delegation belongs to
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
return $this->belongsTo(Process::class, 'PRO_ID', 'PRO_ID');
|
||||
}
|
||||
}
|
||||
@@ -17,5 +17,13 @@ class Process extends Model
|
||||
// We do have a created at, but we don't store an updated at
|
||||
const CREATED_AT = 'PRO_CREATE_DATE';
|
||||
const UPDATED_AT = null;
|
||||
|
||||
/**
|
||||
* Retrieve all applications that belong to this process
|
||||
*/
|
||||
public function applications()
|
||||
{
|
||||
return $this->hasMany(Application::class, 'PRO_ID', 'PRO_ID');
|
||||
|
||||
}
|
||||
}
|
||||
20
workflow/engine/src/ProcessMaker/Model/Task.php
Normal file
20
workflow/engine/src/ProcessMaker/Model/Task.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Task extends Model
|
||||
{
|
||||
protected $table = 'TASK';
|
||||
|
||||
public function process()
|
||||
{
|
||||
return $this->belongsTo(Process::class, 'PRO_UID', 'PRO_UID');
|
||||
}
|
||||
|
||||
public function delegations()
|
||||
{
|
||||
return $this->hasMany(Delegation::class, 'TAS_ID', 'TAS_ID');
|
||||
}
|
||||
}
|
||||
19
workflow/engine/src/ProcessMaker/Model/User.php
Normal file
19
workflow/engine/src/ProcessMaker/Model/User.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $table = "USERS";
|
||||
|
||||
/**
|
||||
* Returns the delegations this user has (all of them)
|
||||
*/
|
||||
public function delegations()
|
||||
{
|
||||
return $this->hasMany(Delegation::class, 'USR_ID', 'USR_ID');
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user