I solved the problem myself: Instead of using...

if($appliances != null){...}

I simply checked if a record in the repository is empty:
foreach($appliances as $appliance)
{
   \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(!empty($appliance));

   if(!empty($appliance)){


   if($appliance->getKundeuid() == $kunde->getUid())
   {
       $name = $appliance->getIpv4intern();
       $address = $appliance->getIpv4extern();
       $file = '/etc/icinga2/conf.d/hosts/'.$kunde->getName().'/Appliance_'. 
$appliance->getIpv4intern().'_'.$kunde->getKundennummer() . '.conf';

       $code_a = 'object Host "';
       $code_b = '" {
       import "generic-host"
       address = "';
       $code_c = '"
       vars.notification["mail"] = {
           groups = [ "icingaadmins" ]
       }
       }';
       $fp = fopen("{$file}", 'wb');
       fwrite($fp, $code_a . $name . $code_b . $address . $code_c);
       fclose($fp);
   }
}
}
_______________________________________________
TYPO3-english mailing list
TYPO3-english@lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english

Reply via email to