Hi Frido,

On 26407 we must use an arrayref as we searched on the same attribute, but
otherwise both syntax are identical.

Koha::Patrons->search({ -or => { surname => 'koha', firstname => 'koha' } })
Koha::Patrons->search({ -or => [ surname => 'koha', firstname => 'koha' ] })
Koha::Patrons->search([ surname => 'koha', firstname => 'koha' ])
Will generate the same query.

Same for:
Koha::Patrons->search({ -and => { surname => 'koha', firstname => 'koha' }
})
Koha::Patrons->search({ -and => [ surname => 'koha', firstname => 'koha' ]
})
Koha::Patrons->search({ surname => 'koha', firstname => 'koha' })

See also https://metacpan.org/pod/SQL::Abstract::Classic#WHERE-CLAUSES

Cheers,
Jonathan


Le mar. 3 nov. 2020 à 09:02, Fridolin SOMERS <fridolin.som...@biblibre.com>
a écrit :

> Hi,
>
> I recently changed a call on Koha::Biblios->search() to use an arrayref
> instead of hashref :
> https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26407
>
> But I see there are both arrayref of hashref existing in code for "-or"
> query.
>
> What is the difference ?
> Is there a way we should choose in guidelines ?
>
> Best regards,
>
> --
> Fridolin SOMERS <fridolin.som...@biblibre.com>
> Software and system maintainer 🦄
> BibLibre, France
> _______________________________________________
> Koha-devel mailing list
> Koha-devel@lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
>
_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to