Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/ObjectDeleteCommand.php
Show All 30 Lines | public function __construct() | ||||
$this->signature .= " {--{$column}=}"; | $this->signature .= " {--{$column}=}"; | ||||
} | } | ||||
} catch (\Exception $e) { | } catch (\Exception $e) { | ||||
\Log::error("Could not extract options: {$e->getMessage()}"); | \Log::error("Could not extract options: {$e->getMessage()}"); | ||||
} | } | ||||
$classes = class_uses_recursive($this->objectClass); | $classes = class_uses_recursive($this->objectClass); | ||||
if (in_array(SoftDeletes::class, $classes)) { | |||||
$this->signature .= " {--with-deleted : Consider deleted {$this->objectName}s}"; | |||||
} | |||||
parent::__construct(); | parent::__construct(); | ||||
} | } | ||||
public function getProperties() | public function getProperties() | ||||
{ | { | ||||
if (!empty($this->properties)) { | if (!empty($this->properties)) { | ||||
return $this->properties; | return $this->properties; | ||||
} | } | ||||
Show All 35 Lines | public function handle() | ||||
if (!$object) { | if (!$object) { | ||||
$this->error("No such {$this->objectName} {$argument}"); | $this->error("No such {$this->objectName} {$argument}"); | ||||
return 1; | return 1; | ||||
} | } | ||||
if ($this->commandPrefix == 'scalpel') { | if ($this->commandPrefix == 'scalpel') { | ||||
$this->objectClass::withoutEvents( | $this->objectClass::withoutEvents( | ||||
function () use ($object) { | function () use ($object) { | ||||
if ($object->deleted_at) { | |||||
$object->forceDelete(); | |||||
machniak: Shouldn't we be less-automatic in the scalpel mode? | |||||
Done Inline ActionsWe establish here the difference between: ./artisan domain:delete kolab.org only ever resulting in Domain('kolab.org')->deleted_at getting set with observers getting executed, and ./artisan domain:force-delete kolab.org wiping the database records all-together, again with observers getting executed. Thus leaving the space for scalpel commands to do the same without observers getting executed. I.e. ./artisan scalpel:domain:delete on a deleted domain will, without observers, execute a force-delete. vanmeeuwen: We establish here the difference between:
```
./artisan domain:delete kolab.org
```
only ever… | |||||
Not Done Inline ActionsThat was preciseely my point. So, ./artisan scalpel:domain:delete does not "switch" into force-deleting "mode" if not told specifically. machniak: That was preciseely my point. So, `./artisan scalpel:domain:delete` does not "switch" into… | |||||
Done Inline ActionsWhat do you mean it doesn't? vanmeeuwen: What do you mean it doesn't? | |||||
} else { | |||||
$object->delete(); | $object->delete(); | ||||
} | } | ||||
} | |||||
); | ); | ||||
} else { | |||||
if ($object->deleted_at) { | |||||
$object->forceDelete(); | |||||
} else { | |||||
$object->delete(); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } |
Shouldn't we be less-automatic in the scalpel mode?