in api added methods: document created and get profile with reports permission
This commit is contained in:
@ -110,4 +110,13 @@ class Document extends \yii\db\ActiveRecord
|
||||
{
|
||||
return $this->hasMany(DocumentFieldValue::className(), ['document_id' => 'id']);
|
||||
}
|
||||
|
||||
public static function getDocument($document_id)
|
||||
{
|
||||
return self::find()
|
||||
->joinWith(['documentFieldValues.field'])
|
||||
->where(['document.id' => $document_id])
|
||||
->asArray()
|
||||
->all();
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveQuery;
|
||||
use yii\db\StaleObjectException;
|
||||
|
||||
/**
|
||||
* This is the model class for table "manager".
|
||||
@ -48,6 +49,10 @@ class Manager extends \yii\db\ActiveRecord
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws StaleObjectException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function beforeDelete()
|
||||
{
|
||||
foreach ($this->managerEmployees as $employee){
|
||||
|
@ -120,16 +120,4 @@ class Template extends \yii\db\ActiveRecord
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
//TODO no need, delete
|
||||
public function getDocumentFields()
|
||||
{
|
||||
$fieldsArray = [];
|
||||
|
||||
foreach ($this->templateDocumentFields as $templateDocField) {
|
||||
$fieldsArray[] = $templateDocField->field;
|
||||
}
|
||||
|
||||
return $fieldsArray;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user