diff --git a/library/X509/Model/Behavior/Ip.php b/library/X509/Model/Behavior/Ip.php index 34ae8e17..3ca1a351 100644 --- a/library/X509/Model/Behavior/Ip.php +++ b/library/X509/Model/Behavior/Ip.php @@ -2,16 +2,18 @@ namespace Icinga\Module\X509\Model\Behavior; +use ipl\Orm\Behavior\Binary; use ipl\Orm\Contract\PropertyBehavior; /** * Support automatically transformation of human-readable IP addresses into their respective packed * binary representation and vice versa. */ -class Ip extends PropertyBehavior +class Ip extends Binary { public function fromDb($value, $key, $_) { + $value = parent::fromDb($value, $key, $_); if ($value === null) { return null; } @@ -30,6 +32,6 @@ public function toDb($value, $key, $_) return $value; } - return str_pad(inet_pton($value), 16, "\0", STR_PAD_LEFT); + return parent::toDb(str_pad(inet_pton($value), 16, "\0", STR_PAD_LEFT), $key, $_); } } diff --git a/library/X509/Model/X509Target.php b/library/X509/Model/X509Target.php index 2328b5d4..978e6f27 100644 --- a/library/X509/Model/X509Target.php +++ b/library/X509/Model/X509Target.php @@ -56,7 +56,6 @@ public function getSearchColumns() public function createBehaviors(Behaviors $behaviors) { $behaviors->add(new Ip(['ip'])); - $behaviors->add(new Binary(['ip'])); $behaviors->add(new MillisecondTimestamp([ 'ctime',