|
@@ -2,12 +2,15 @@
|
|
|
|
|
|
namespace RadiusBundle\Entity;
|
|
|
|
|
|
+use Base\AdminBundle\Interfaces\SoftDeleteInterface;
|
|
|
use Base\AdminBundle\Traits\TenancyIdTrait;
|
|
|
use Base\AdminBundle\Traits\TenancyIdTraitInterface;
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
use DeviceBundle\Interfaces\DeviceInterface;
|
|
|
use DeviceBundle\Validator\Constraints as ValidatorAssert;
|
|
|
use ExtraDataBundle\Entity\Traits\ExtraDataTrait;
|
|
|
+use Gedmo\Mapping\Annotation as Gedmo;
|
|
|
+use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity as SoftDeleteable;
|
|
|
use MapBundle\Entity\Interfaces\LocationInterface;
|
|
|
use MapBundle\Entity\Traits\LocationTrait;
|
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
@@ -20,14 +23,17 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|
|
*
|
|
|
* @UniqueEntity(fields={"host", "tenancyId"}, message="errors.duplicate_key")
|
|
|
*
|
|
|
+ * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=true)
|
|
|
+ *
|
|
|
* @ValidatorAssert\Device
|
|
|
*/
|
|
|
-class NAS implements TenancyIdTraitInterface, DeviceInterface, LocationInterface
|
|
|
+class NAS implements TenancyIdTraitInterface, DeviceInterface, LocationInterface, SoftDeleteInterface
|
|
|
{
|
|
|
|
|
|
use ExtraDataTrait;
|
|
|
use TenancyIdTrait;
|
|
|
use LocationTrait;
|
|
|
+ use SoftDeleteable;
|
|
|
|
|
|
/**
|
|
|
* @var int
|
|
@@ -268,8 +274,13 @@ class NAS implements TenancyIdTraitInterface, DeviceInterface, LocationInterface
|
|
|
$deviceData['ip'] = $this->host;
|
|
|
$deviceData['tenancy'] = $this->tenancyId;
|
|
|
|
|
|
- $deviceExtraData = array('snmpCommunity' => $this->snmpComunity, 'snmpVersion' => $this->snmpVersion, 'radiusPassword' => $this->radiusPassword,
|
|
|
- 'acctEnabled' => $this->acctEnabled, 'description' => $this->description);
|
|
|
+ $deviceExtraData = array(
|
|
|
+ 'snmpCommunity' => $this->snmpComunity,
|
|
|
+ 'snmpVersion' => $this->snmpVersion,
|
|
|
+ 'radiusPassword' => $this->radiusPassword,
|
|
|
+ 'acctEnabled' => $this->acctEnabled,
|
|
|
+ 'description' => $this->description
|
|
|
+ );
|
|
|
|
|
|
if ($this->model) {
|
|
|
$model = $this->getModel();
|
|
@@ -280,11 +291,20 @@ class NAS implements TenancyIdTraitInterface, DeviceInterface, LocationInterface
|
|
|
$deviceExtraData['library'] = null;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
$deviceData['extraData'] = json_encode($deviceExtraData);
|
|
|
|
|
|
return $deviceData;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getSoftDeleteCriteria()
|
|
|
+ {
|
|
|
+ return [
|
|
|
+ 'host' => $this->host,
|
|
|
+ ];
|
|
|
+ }
|
|
|
|
|
|
}
|