API page: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Database%...

Enter a descriptive title (above) relating to public function Select::execute, then describe the problem you have found:

Select::execute() would benefit from a @return [TYPE] line that tells you what the return type would be. There doesn't seem to be a link to that type anywhere obvious on this page, which means you can't jump to the class and find out what you are supposed to be able to do with the results. Very annoying.

I think it returns a \Drupal\Core\Database\StatementInterface, but I'm not sure.

Comments

longwave’s picture

Status: Active » Needs review
StatusFileSize
new15.3 KB

Got a bit carried away, and added missing docblocks (of which there were many!) to \Drupal\Core\Database\Query\Select. Most of them are just @inheritdoc but the ones that deal with HAVING clauses needed copying and amending from ConditionInterface.

longwave’s picture

Actually I wonder if those having* functions should be moved to SelectInterface?

jhodgdon’s picture

Thanks for getting carried away! Looks great!

I just noticed a couple of things, and then we can get this in:

a) core/lib/Drupal/Core/Database/Query/Select.php

+   * @return
+   *   An associative array of placeholders and values.
+   */
   public function havingArguments() {

This could say @return array ?

b) same class

+   * @return \Drupal\Core\Database\Query\SelectInterface
+   *   The called object.
+   */
   public function having($snippet, $args = array()) {

This should say @return $this with no docs on the next line. Same on havingIsNull(), havingIsNotNull(), havingExists(), havingNotExists(). That's kind of a new standard:
https://drupal.org/node/1354#types

c) same class

+  /**
+   * Compiles the HAVING clause for later retrieval.
+   *
+   * @param $connection
+   *   The database connection for which to compile the clause.
+   */
   public function havingCompile(Connection $connection) {
     return $this->having->compile($connection, $this);
   }

No @return here?

d) And regarding #2, it looks like both Select and SelectExtender implement that interface, and SelectExtender does not currently have all those methods, so not all of them can be moved to the interface. The ones that are already on SelectExtender are probably OK to move.

jhodgdon’s picture

Status: Needs review » Needs work

And one other thing, if you change code and not just docs, we'll need to get extra reviewers and move this to the database component.

longwave’s picture

longwave’s picture

Status: Needs work » Needs review
StatusFileSize
new15.33 KB
new2.98 KB

Fixed #3.a and #3.b.

#3.c is unchanged - I don't see the point in documenting it returns NULL for now, because really that return statement should removed in the above linked issue.

#3.d I left alone as well, as I don't fully understand the implications of moving to the interface, and that seems even further out of scope than everything else I fixed here.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Agreed. Looks good!

jhodgdon’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Patch no longer applies :(

Alumei’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new15.33 KB

Re-roll.

Status: Needs review » Needs work

The last submitted patch, 9: 2212437-dbtng-docs-9.patch, failed testing.

Alumei’s picture

Status: Needs work » Needs review
StatusFileSize
new15.32 KB

Re-rolled again.

jhodgdon’s picture

Status: Needs review » Fixed

Thanks for the reroll (and thanks again for the earlier patch)! Looks like a clean reroll, committed to 8.x.

longwave: it was your fix to that other issue about the having method that broke your patch here. ;)

Status: Fixed » Needs work

The last submitted patch, 11: 2212437-dbtng-docs-10.patch, failed testing.

jhodgdon’s picture

Status: Needs work » Fixed

doh! testbot that is because I already committed the patch!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.