FaaPz/PDO

README not up to date

Closed this issue ยท 4 comments

Hello,

In the README, you mention the possibility to use insert with an associative array:

$insert = $database->insert([
                       'id' =>1234,
                       'username' => 'user',
                       'password' => 'passwd'
                   ])
                   ->into('users');

But it is not possible anymore as you are using the splat operator as you can see on the error below :

image

Is this wanted ? If true, README should be updated and documentation too, otherwise, the functionality should be fixed

Thanks a lot,

kwhat commented

I just updated 2.x. Let me know if you find any other issues.

I just updated 2.x. Let me know if you find any other issues.

I will !
In fact, I am, in the README the list of columns should be surrounded by brackets as columns method only accept one argument. Or is the doc about Insert is not up to date either ? Insert.md
So you confirm that it's a decision to remove to possibility to use key-value array for insert ?

Thanks for your help anyway ๐Ÿ˜„

kwhat commented

It takes a column array without values because it now supports multiple calls to ->values(). This probably wasn't the best decision on my part.

It takes a column array without values because it now supports multiple calls to ->values(). This probably wasn't the best decision on my part.

Wouldn't it have been better to use overload methods ? Or even just keep the array key/value method with another name and that would reproduce behaviour of ->columns()->values() ?