-
Notifications
You must be signed in to change notification settings - Fork 6
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
Feature/added shortcuts #11
Conversation
src/Connection.php
Outdated
* connection->findOneById('table', ['id' => 1]); | ||
* | ||
* @param string $table | ||
* @param array $id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd name it $where
or $conditions
since it doesn't necessarily have to be primary key (same for delete and update) and name the method simply findOneBy
.
src/Connection.php
Outdated
* @param string $table | ||
* @param array $id | ||
* | ||
* @return array|null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@return PromiseInterface<mixed[]|null>
src/Connection.php
Outdated
/** | ||
* Find by. | ||
* | ||
* connection->findOneById('table', ['id' => 1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy paste error - this is the findBy method
->values(array_combine( | ||
array_keys($values), | ||
array_fill(0, count($values), '?') | ||
)) | ||
->setParameters(array_values($values)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I prefer my simple foreach over these array shenanigans but whatever.
src/Connection.php
Outdated
string $table, | ||
array $id, | ||
array $values | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing return type
* @param array $id | ||
* @param array $values | ||
* | ||
* @return PromiseInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Promise of...? @return PromiseInterface<...>
@@ -20,7 +20,7 @@ | |||
use Exception; | |||
|
|||
/** | |||
* Class MockedDriver | |||
* Class MockedDriver. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments like these are totally useless. I highly recommend removing them everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your recommendation. I like these redundant comments 👍
* @param Connection $connection | ||
* | ||
* @return PromiseInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@param
is redundant since there is typehint, @return
should be made non-redundant by adding the type of the resolved value as <...>
.
a038338
to
9fe3702
Compare
- findOneBy - findBy - insert - update - upsert - delete
9fe3702
to
24c36e9
Compare
No description provided.