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

Parameter default values #102

Open
IanDelMar opened this issue Dec 23, 2024 · 0 comments
Open

Parameter default values #102

IanDelMar opened this issue Dec 23, 2024 · 0 comments

Comments

@IanDelMar
Copy link

IanDelMar commented Dec 23, 2024

PostmanEmailQueryLog::get_all_logs() : The default value of $ids should be array(-1) to prevent $ids from being an empty string.

public function get_all_logs( $ids = array() ) {
$ids = implode( ',', $ids );
$ids = $ids == -1 ? '' : "WHERE id IN ({$ids});";
return $this->db->get_results(
$this->db->prepare(
"SELECT * FROM %i {$ids}",
$this->table
)
);
}

PostmanEmailLogs::save(): The default value of $id should be 0 as PostmanEmailLogs::update() expects $id to be int.

public function save( $data, $id = '' ) {
$data['time'] = !isset( $data['time'] ) ? current_time( 'timestamp' ) : $data['time'];
if( !empty( $id ) ) {
return $this->update( $data, $id );
}
else {
return $this->db->insert(
$this->db->prefix . $this->db_name,
$data
) ? $this->db->insert_id : false;
}
}

@IanDelMar IanDelMar changed the title PostmanEmailQueryLog::get_all_logs() parameter default value Parameter default values Dec 23, 2024
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