public function mapEntity($entity, $entityName = null)
    {
        // It's module entity
        if (is_null($entityName)) {
            if (empty($this->module)) {
                throw new \Exception('Invalid module, it must be set before mapping entity', 1);
            }
            $entityName = $this->module;
            $entity = [$entity];
        }

        $xml = '<' . $entityName . '>';
        $xml .= is_array($entity) ? $this->mapEntityList($entity) : $this->mapSingleEntity($entity);
        $xml .= '</' . $entityName . '>';
        return $xml;
    }
public function mapEntity($entity, $entityName = null)
    {
        // It's module entity
        if (is_null($entityName)) {
            if (empty($this->module)) {
                throw new \Exception('Invalid module, it must be set before mapping entity', 1);
            }
            $entityName = $this->module;
            $entity = [$entity];
        }

        $xml = '<' . $entityName . '>';
        $xml .= is_array($entity) ? $this->mapEntityList($entity) : $this->mapSingleEntity($entity);
        $xml .= '</' . $entityName . '>';
        return $xml;
    }
public function mapEntity ( $ entity , $ entityName = null ) { // It's module entity if ( is_null ( $ entityName ) ) { if ( empty ( $ this -> module ) ) { throw new \ Exception ( 'Invalid module, it must be set before mapping entity' , 1 ) ; } $ entityName = $ this -> module ; $ entity = [ $ entity ] ; } $ xml = '<' . $ entityName . '>' ; $ xml .= is_array ( $ entity ) ? $ this -> mapEntityList ( $ entity ) : $ this -> mapSingleEntity ( $ entity ) ; $ xml .= '</' . $ entityName . '>' ; return $ xml ; }
Convert an entity into XML

@param Element $entity     Element
@param string  $entityName Element name
@return string XML created
@throws \Exception
Convert an entity into XML