Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

root and child with the same name #201

Open
brunocunha00 opened this issue Apr 28, 2021 · 0 comments
Open

root and child with the same name #201

brunocunha00 opened this issue Apr 28, 2021 · 0 comments

Comments

@brunocunha00
Copy link

I have an unusual situation

the service I'm consuming returns the tag 'Address' and one of its children also has the tag 'Address' like the example below

`[Endereco] => Array
(

  [0] => Array
      (
          [name] => {http://www.abrasf.org.br/nfse.xsd}Endereco
          [value] => RUA CUIABA
          [attributes] => Array
              (
              )
      )

  [1] => Array
      (
          [name] => {http://www.abrasf.org.br/nfse.xsd}Numero
          [value] => 96
          [attributes] => Array
              (
              )
      )

  [2] => Array
      (
          [name] => {http://www.abrasf.org.br/nfse.xsd}Bairro
          [value] => Prado
          [attributes] => Array
              (
              )
      )

  [3] => Array
      (
          [name] => {http://www.abrasf.org.br/nfse.xsd}CodigoMunicipio
          [value] => 3106200
          [attributes] => Array
              (
              )
      )

  [4] => Array
      (
          [name] => {http://www.abrasf.org.br/nfse.xsd}Uf
          [value] => MG
          [attributes] => Array
              (
              )
      )
  [5] => Array
      (
          [name] => {http://www.abrasf.org.br/nfse.xsd}Cep
          [value] => 30411180
          [attributes] => Array
              (
              )
      )

)
`
so if I do the mapping of 'Address' it understands as if the two were root

$this->sabre->elementMap['{http://www.abrasf.org.br/nfse.xsd}Endereco'] = function($reader){ return \Sabre\Xml\Deserializer\keyValue($reader, 'http://www.abrasf.org.br/nfse.xsd'); };

`
[Endereco] => Array
(

  [Endereco] => Array () **_HERE SHOULD BE 'RUA A'_**
   [Numero] => 96
  [Bairro] => Prado
  [CodigoMunicipio] => 3106200
  [Uf] => MG
  [Cep] => 30411180

)`

as root and child have the same name it recognizes as an array and not as a string as it should be

what would be the best option to get around this problem? (sorry my english, i'm using translator)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant