A lot of things.
This commit is contained in:
40
Service/Club/DeleterService.php
Normal file
40
Service/Club/DeleterService.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace RomhackPlaza\Master\Service\Club;
|
||||
|
||||
use RomhackPlaza\Master\Entity\Club;
|
||||
use XF\App;
|
||||
use XF\Entity\Forum;
|
||||
use XF\Entity\Node;
|
||||
use XF\Http\Upload;
|
||||
use XF\Service\AbstractService;
|
||||
use XF\Service\ValidateAndSavableTrait;
|
||||
use XF\Util\File;
|
||||
|
||||
class DeleterService extends AbstractService
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Club
|
||||
*/
|
||||
protected $club;
|
||||
|
||||
public function __construct(App $app, Club $club)
|
||||
{
|
||||
parent::__construct($app);
|
||||
|
||||
$this->club = $club;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if( $this->club->Forum && $this->club->Forum->Node ){
|
||||
$this->club->Forum->Node->delete();
|
||||
}
|
||||
|
||||
$path = 'data://club_banners/' . $this->club->club_id . '.jpg';
|
||||
File::deleteFromAbstractedPath($path);
|
||||
|
||||
$this->club->delete();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user