Ahhhh OK thanks a lot for the explanation ;)
Le 03/11/2020 à 11:30, Jonathan Druart a écrit :
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
<https://metacpan.org/pod/SQL::Abstract::Classic#WHERE-CLAUSES>
Cheers,
Jonathan
Le mar. 3 nov. 2020 à 09:02, Fridolin SOMERS
<fridolin.som...@biblibre.com <mailto: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
<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
<mailto:fridolin.som...@biblibre.com>>
Software and system maintainer 🦄
BibLibre, France
_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
<mailto:Koha-devel@lists.koha-community.org>
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
<https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel>
website : http://www.koha-community.org/
<http://www.koha-community.org/>
git : http://git.koha-community.org/ <http://git.koha-community.org/>
bugs : http://bugs.koha-community.org/ <http://bugs.koha-community.org/>
--
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/