WebAPI-DBIC icon indicating copy to clipboard operation
WebAPI-DBIC copied to clipboard

Add support for DBIC "join" directly

Open castaway opened this issue 10 years ago • 0 comments

DBIx::Class' "join" search attribute has a use separate to that of "prefetch" .. Prefetch includes all the content from all the listed related tables, whereas join just makes a simple sql JOIN.

Example: I want to fetch all the CDs by artist X, without displaying the artist data: /cd?join~json={"cd_artists":"artist"}&artist.id=XX would just return a set of CD data with the filter applied, and no artist or cd_artist data.. saving all the extra object generation.

equivalent dbic: $cd_rs->search({ 'artist.id' => 12 }, { join => { 'cd_artists' => 'artist' } });

castaway avatar Feb 02 '15 10:02 castaway