-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
better draft handling, save handling, and delete support
- Loading branch information
Showing
9 changed files
with
292 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace markhuot\keystone\actions; | ||
|
||
use markhuot\keystone\models\Component; | ||
use yii\db\Expression; | ||
|
||
class DeleteComponent | ||
{ | ||
public function handle(Component $component) | ||
{ | ||
Component::updateAll(['sortOrder' => new Expression('sortOrder - 1')], ['and', | ||
['elementId' => $component->elementId], | ||
['fieldId' => $component->fieldId], | ||
['>', 'sortOrder', $component->sortOrder] | ||
]); | ||
|
||
$component->delete(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.