Scalr\Stats\CostAnalytics\Entity\ProjectEntity::delete PHP Method

delete() public method

See also: Scalr\Model\AbstractEntity::delete()
public delete ( )
    public function delete()
    {
        if ($this->checkRemoval()) {
            //Completely remove it
            parent::delete();
            ReportEntity::deleteBy([['subjectId' => $this->projectId], ['subjectType' => ReportEntity::SUBJECT_TYPE_PROJECT]]);
            NotificationEntity::deleteBy([['subjectId' => $this->projectId], ['subjectType' => NotificationEntity::SUBJECT_TYPE_PROJECT]]);
        } else {
            //Archive it
            $this->archived = true;
            $this->save();
        }
    }