/** * @param IXP_Form_Interface_Physical $form The form object * @param \Entities\PhysicalInterface $object The Doctrine2 entity (being edited or blank for add) * @param bool $isEdit True of we are editing an object, false otherwise * @return bool */ protected function addPostValidate($form, $object, $isEdit) { $sp = $this->getD2R('\\Entities\\SwitchPort')->find($form->getElement('switchportid')->getValue()); // set the switch port type to peering $sp->setType(\Entities\SwitchPort::TYPE_PEERING); $object->setSwitchPort($sp); $vi = $this->getD2EM()->getRepository('\\Entities\\VirtualInterface')->find($form->getElement('virtualinterfaceid')->getValue()); $object->setVirtualInterface($vi); // FIXME We should do more than just ensure it's not an edit here. You could edit to a non-unique value... if (!$isEdit && !$vi->getCustomer()->isUniqueMonitorIndex($form->getValue('monitorindex'))) { $this->addMessage('The monitor index must be unique. It has been reset below to a unique value.', OSS_Message::ERROR); $form->getElement('monitorindex')->setValue($this->getD2R('\\Entities\\PhysicalInterface')->getNextMonitorIndex($vi->getCustomer())); return false; } if ($form->getElement('fanout')) { if (!$this->processFanoutPhysicalInterface($form, $object, $vi)) { return false; } } if ($object->getRelatedInterface()) { $object->getRelatedInterface()->setSpeed($form->getValue("speed")); $object->getRelatedInterface()->setStatus($form->getValue("status")); $object->getRelatedInterface()->setDuplex($form->getValue("duplex")); } return true; }
public function setSwitchPort(\Entities\SwitchPort $switchPort = NULL) { $this->__load(); return parent::setSwitchPort($switchPort); }