final public function swapEntity($tag, BaseInterface $entity)
    {
        if (!isset($this->entities[$tag])) {
            throw new \RuntimeException("Unable to swap entity that does not exist");
        }
        $this->entities[$tag] = $entity;
        $entity->setFormTag($tag);
        $this->getEventManager()
            ->trigger(self::EVENT_CONFIGURE_ENTITY.$tag, $this, array(
                'tag' => $tag,
                'entity' => $entity,
                'entities' => $this->getEntities(),
            ));

        return $this;
    }
final public function swapEntity($tag, BaseInterface $entity)
    {
        if (!isset($this->entities[$tag])) {
            throw new \RuntimeException("Unable to swap entity that does not exist");
        }
        $this->entities[$tag] = $entity;
        $entity->setFormTag($tag);
        $this->getEventManager()
            ->trigger(self::EVENT_CONFIGURE_ENTITY.$tag, $this, array(
                'tag' => $tag,
                'entity' => $entity,
                'entities' => $this->getEntities(),
            ));

        return $this;
    }
final public function swapEntity ( $ tag , BaseInterface $ entity ) { if ( ! isset ( $ this -> entities [ $ tag ] ) ) { throw new \ RuntimeException ( "Unable to swap entity that does not exist" ) ; } $ this -> entities [ $ tag ] = $ entity ; $ entity -> setFormTag ( $ tag ) ; $ this -> getEventManager ( ) -> trigger ( self :: EVENT_CONFIGURE_ENTITY . $ tag , $ this , array ( 'tag' => $ tag , 'entity' => $ entity , 'entities' => $ this -> getEntities ( ) , ) ) ; return $ this ; }
Utility to replace an entity at a tag
@param $tag
@param  BaseInterface     $entity
@return $this
@throws \RuntimeException
Utility to replace an entity at a tag