Skip to content

Validate before binding whereIn values array - #2

Open
praem90 wants to merge 1 commit into
adreastrian:masterfrom
praem90:bugfix/ignore-whereIn-if-empty
Open

Validate before binding whereIn values array#2
praem90 wants to merge 1 commit into
adreastrian:masterfrom
praem90:bugfix/ignore-whereIn-if-empty

Conversation

@praem90

@praem90 praem90 commented Nov 26, 2021

Copy link
Copy Markdown

##The Problem

$post_ids = array();

$query = wpFluent()->table('posts')->whereIn('ID', $post_ids);

// SELECT * from wp_posts where ID in (); 
// Throws query exception and return empty

By wrapping whereIns with when ignores the empty array,

// SELECT * from wp_posts

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

Successfully merging this pull request may close these issues.

1 participant