fix Detach file
This commit is contained in:
parent
567ab20361
commit
5cdd516696
@ -379,4 +379,8 @@ class UserCard extends \yii\db\ActiveRecord
|
|||||||
|
|
||||||
return UserCard::find()->where([ 'IN', 'id_user', $usersId])->all();
|
return UserCard::find()->where([ 'IN', 'id_user', $usersId])->all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getCardByStatus($status_id){
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ class FileController extends ApiController
|
|||||||
*
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* @OA\MediaType(
|
* @OA\MediaType(
|
||||||
* mediaType="multipart/form-data",
|
* mediaType="application/x-www-form-urlencoded",
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* required={"file_id", "entity_type", "entity_id"},
|
* required={"file_id", "entity_type", "entity_id"},
|
||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
@ -232,14 +232,14 @@ class FileController extends ApiController
|
|||||||
*/
|
*/
|
||||||
public function actionDetach(): FileEntity
|
public function actionDetach(): FileEntity
|
||||||
{
|
{
|
||||||
$request = \Yii::$app->request->post();
|
$request = \Yii::$app->request->getBodyParams();
|
||||||
$file = File::findOne($request['file_id']);
|
$file = File::findOne($request['file_id']);
|
||||||
if (!$file) {
|
if (!$file) {
|
||||||
throw new NotFoundHttpException('File bot found');
|
throw new NotFoundHttpException('File bot found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileEntity = new FileEntity();
|
$fileEntity = FileEntity::findOne(['file_id' => $request['file_id'], 'entity_type' => $request['entity_type'], 'entity_id' => $request['entity_id']]);
|
||||||
$fileEntity->load($request, '');
|
//$fileEntity->load($request, '');
|
||||||
$fileEntity->status = FileEntity::STATUS_DISABLE;
|
$fileEntity->status = FileEntity::STATUS_DISABLE;
|
||||||
|
|
||||||
if (!$fileEntity->validate()) {
|
if (!$fileEntity->validate()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user