public function getRelatedInterface() { $this->__load(); return parent::getRelatedInterface(); }
/** * Function which can be over-ridden to perform any post-deletion tasks * * Database `flush()` has been successfully completed at this stage * * If you return with true, then the standard log message and OSS_Message * will be performed. If you want to override these, return false. * * NB: also calls `postFlush()` * * @param \Entities\PhysicalInterface $object The Doctrine2 entity to delete * @return bool Return false to stop / cancel standard log and OSS_Message */ protected function postDelete($object) { if ($this->getParam('related', false) && $object->getRelatedInterface()) { $this->removeRelatedInterface($object); $this->getD2EM()->flush(); } return $this->postFlush($object); }
/** * Removes related interface * * Removes a related interface and if it only has one physical interface, removes the virtual interface also * * @param \Entities\PhysicalInterface $pi Physical interface to remove related physical interface. * @return void */ private function removeRelatedInterface($pi) { $pi->getRelatedInterface()->getSwitchPort()->setPhysicalInterface(null); if (count($pi->getRelatedInterface()->getVirtualInterface()->getPhysicalInterfaces()) == 1) { foreach ($pi->getRelatedInterface()->getVirtualInterface()->getVlanInterfaces() as $fnvi) { $this->getD2EM()->remove($fnvi); } foreach ($pi->getRelatedInterface()->getVirtualInterface()->getMACAddresses() as $mac) { $this->getD2EM()->remove($mac); } $this->getD2EM()->remove($pi->getRelatedInterface()->getVirtualInterface()); $this->getD2EM()->remove($pi->getRelatedInterface()); } else { $this->getD2EM()->remove($pi->getRelatedInterface()); } }