How do i get create a "Mautic\CoreBundle\Entity\IpAddress" object

I either want to create one from scratch or get one based on a record from the database.

when i do

$ip = "105.233.34.7";

        $IpAddressObject = new IpAddress();
        $IpAddressObject->setIpAddress($ip);

        $hit->setIpAddress($IpAddressObject);

i get error

[2022-01-18 08:07:20] mautic.CRITICAL: Uncaught PHP Exception Doctrine\ORM\ORMException: 
"The EntityManager is closed." at /home/csanewsc/public_html/crm/vendor/doctrine/orm/lib
/Doctrine/ORM/ORMException.php line 145 {"exception":"[object] (Doctrine\\ORM
\\ORMException(code: 0): The EntityManager is closed. at /home/csanewsc/public_html/crm/vendor
/doctrine/orm/lib/Doctrine/ORM/ORMException.php:145)"} []