/**
  * Pre db flush hook that can be overridden by subclasses for add and edit.
  *
  * This is called if the user POSTs a valid form after the posted
  * data has been assigned to the object and just before it is (persisted
  * if adding) and the database is flushed.
  *
  * This hook can prevent flushing by returning false.
  *
  * **NB: You should not `flush()` here unless you know what you are doing**
  *
  * A call to `flush()` is made after this method returns true ensuring a
  * transactional `flush()` for all.
  *
  * @param OSS_Form $form The Send form object
  * @param \Entities\Infrastructure $object The Doctrine2 entity (being edited or blank for add)
  * @param bool $isEdit True if we are editing, otherwise false
  * @return bool If false, the form is not persisted
  */
 protected function addPreFlush($form, $object, $isEdit)
 {
     $ixp = $this->getD2R('\\Entities\\IXP')->find($form->getValue('ixp'));
     if (!$ixp) {
         $this->addMessage('There is an issue with your infrastructures as we could not load an infrastructure with ID ' . $form->getValue('ixp'), OSS_Message::ERROR);
         return false;
     }
     $object->setIXP($ixp);
     // if we're setting this infra as the primary, ensure the rest in this IXP are not primary
     if ($object->getIsPrimary()) {
         foreach ($ixp->getInfrastructures() as $i) {
             if ($i->getId() != $object->getId()) {
                 $i->setIsPrimary(false);
             }
         }
     }
     return true;
 }
 public function getAggregateGraphName()
 {
     $this->__load();
     return parent::getAggregateGraphName();
 }