Problem/Motivation

Some comment in \Drupal\Core\Entity\Query\Sql\Tables are hard to read.

Original issue summary

Issue referred from https://www.drupal.org/node/2599524#comment-10490444

    +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -235,7 +235,9 @@ public function isFieldCaseSensitive($field_name) {
    
    @@ -235,7 +235,9 @@ public function isFieldCaseSensitive($field_name) {
        * Join entity table if necessary and return the alias for it.
        *
        * @param string $property
    +   *
        * @return string
    +   *
        * @throws \Drupal\Core\Entity\Query\QueryException
        */

    Sigh. This @param and @return need to have docs added to them. Having @param and @return with only a type and no documentation is not OK.

Steps to reproduce

Proposed resolution

Adjust the grammar.

Remaining tasks

Review
Commit

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-2601282

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

krknth created an issue. See original summary.

krknth’s picture

Assigned: krknth » Unassigned
Status: Active » Needs review
StatusFileSize
new2.79 KB

Added patch.

krknth’s picture

Issue summary: View changes
nicrodgers’s picture

Status: Needs review » Needs work

Patch applies cleanly to 8.0.x and corrects the 3 issues above. Great stuff.

However I see there is an outstanding issue with:

    * @param $field_name
    *   Name of the field.
+   *
    * @return string
+   *
    * @throws \Drupal\Core\Entity\Query\QueryException
    */
   protected function ensureFieldTable($index_prefix, &$field, $type, $langcode, $base_table, $entity_id_field, $field_id_field) {

$field_name isn't a parameter for this method, and the parameters need documenting too.

nicrodgers’s picture

Issue tags: +rc eligible, +Novice
krknth’s picture

@nicrodgers : oops confused. working on.

krknth’s picture

Status: Needs work » Needs review
StatusFileSize
new3.26 KB

Added new patch & hiding old one as it wrong patch.

jhodgdon’s picture

Status: Needs review » Postponed

I think we need to wait on this patch until #2599524: Fixing order of documentation sections for /core/lib/Drupal is done, because it will conflict. Right? Either that or postpone the other one.

Also, when we get back to this, the sections of additional documentation in the Tables class need a lot more work... basically the docs are not telling me what the parameters really are. For example:

  1. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,8 +234,24 @@ public function isFieldCaseSensitive($field_name) {
    +   * @param string $index_prefix
    +   *   Table prefix name.
    

    Huh, that is odd. So the parameter is called $index_prefix and it is the prefix for a table? What does this mean?

  2. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,8 +234,24 @@ public function isFieldCaseSensitive($field_name) {
        * @param string $property
    +   *   Field name.
    

    $property is a field name for what?

  3. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,8 +234,24 @@ public function isFieldCaseSensitive($field_name) {
    +   * @param string $id_field
    +   *   Field name.
    

    This has the same documentation as $property above. That is not OK. What is the difference? Both need better docs.

  4. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,8 +234,24 @@ public function isFieldCaseSensitive($field_name) {
    +   * @param array $entity_tables
    +   *   Array of tables.
    

    Array of what tables?

  5. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,8 +234,24 @@ public function isFieldCaseSensitive($field_name) {
        * @return string
    +   *   Returns table alias.
    

    We don't normally start @return docs with
    "Returns".

    Just say "The table alias".

Note that the other method with added docs has the same problems.

krknth’s picture

@jhodgdon : yes, it will conflict.

Will fix your comments once other issue is ported.

jhodgdon’s picture

Title: Fixing typo's and docblock's for core/lib/Drupal/Core/Entity » Fixing typos and docblocks for core/lib/Drupal/Core/Entity

Title was bugging me. Apostrophe is possession, not plural. ;)

xjm’s picture

Status: Postponed » Needs work

That patch is in.

rakesh.gectcr’s picture

Assigned: Unassigned » rakesh.gectcr
rakesh.gectcr’s picture

StatusFileSize
new3.15 KB

@here,

I am not able to apply the 2601282-2.patch. So i created the new one, which is according to the @jhodgdon comment #8. Please review the attached patch.

rakesh.gectcr’s picture

Status: Needs work » Needs review

The last submitted patch, 7: 2601282-2.patch, failed testing.

jhodgdon’s picture

Status: Needs review » Needs work

Sorry, but I still do not think that the @param documentation in this latest patch is accurately describing what the parameters are.

For instance, when I look at $index_prefix, the patch says it is "Index to prefix with the table name.". Besides the fact that I do not even understand what that is really supposed to mean, it's definitely not an index and it definitely is not prefixed with the table name. What it really is, looking at the code, is a string that for some unknown (to me) reason, is being added as a prefix to the table name when the table is added to the $entityTables member variable. The previous patch, which said "Table prefix name" was at least closer to correct, but it still didn't tell me what I would need to pass in for this value. I really have no idea what the correct documentation would be -- looking at the code in this function, it's not obvious. I'd need to look at where it was called and then how the $entityTables member variable was used elsewhere, in order to figure it out.

Similarly, the other parameter documentation I looked at, for the next few parameters, is either not understandable or wrong.

So, someone needs to carefully read through the code here, including looking at where these functions are called and what is passed in by the calling functions and how the saved values are used later, and figure out what the parameters really are, how they are used, and what their values should be. Then document them appropriately.

chx’s picture

The index_prefix is documented in addField (my bad, should've been a param doxygen):

    // This variable ensures grouping works correctly. For example:
    // ->condition('tags', 2, '>')
    // ->condition('tags', 20, '<')
    // ->condition('node_reference.nid.entity.tags', 2)
    // The first two should use the same table but the last one needs to be a
    // new table. So for the first two, the table array index will be 'tags'
    // while the third will be 'node_reference.nid.tags'.
rakesh.gectcr’s picture

StatusFileSize
new4.15 KB
new2.23 KB

@chx,
Thanks for the help in IRC.

@jhodgdon
According to the discussion with @chx , Done couple of changes.

rakesh.gectcr’s picture

Status: Needs work » Needs review

The last submitted patch, 7: 2601282-2.patch, failed testing.

jhodgdon’s picture

Status: Needs review » Needs work

OK.... So let's look at this whole documentation block. The first line says:

Join entity table if necessary and return the alias for it.

There is nothing in there about fields or relationships or anything. Then the proposed docs launch into talking about fields and relationships and etc, and I have no context for understanding what it is talking about.

So we need more explanation about what this method does and what it is for. The first line, which is all we have for an overview, just says it is joining an entity table, but the rest is about... I have no idea. All of the proposed param docs seem to presume some knowledge or context that is not there at all in the docs. What is this method really for? Why are we joining the entity table? Why would it be necessary? What is the context?

Here are my specific confusions, plus a specific suggestion about the prefix parameter:

  1. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,9 +234,34 @@ public function isFieldCaseSensitive($field_name) {
    +   *   Table name prefix to discern the same table used in several
    +   *   relationships.
    +   *   Example:
    +   *   When its empty.
    +   *   @code
    +   *   ->condition('tags', 2, '>')
    +   *   @endcode
    +   *   When it is node_reference.nid.
    +   *   @code
    +   *   ->condition('node_reference.nid.entity.tags', 2)
    +   *   @endcode
    

    The first sentence here contradicts the examples. The sentence says it is a prefix for the table name. The examples are showing it as being a prefix for field names.

    I think the correct answer is that it is a prefix for table names.

    The examples formatting is also not great... I think we can leave them out.

    How about changing this to just:

    Prefix that will be put on this table in queries, when it is used within this relationship.

    and leaving off the examples, which I think just confuse me.

  2. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,9 +234,34 @@ public function isFieldCaseSensitive($field_name) {
        * @param string $property
    +   *   Mapped field table name.
    

    What does this mean? I don't know what "$property" should be in the context of "Join entity table". And "Mapped field table name" doesn't seem to related to "$property" at all, and besides which, I don't know what "mapped" means or what "field table" is. The context of this needs to be explained.

  3. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,9 +234,34 @@ public function isFieldCaseSensitive($field_name) {
    +   * @param string $base_table
    +   *   Base table name.
    

    What does this mean? Base table for what?

  4. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,9 +234,34 @@ public function isFieldCaseSensitive($field_name) {
    +   * @param string $id_field
    +   *   Field name.
    

    What field name, and why is it "field name" when the parameter is $id_field? How is it different from $property? What is the context here -- all I know is I'm checking to see if some entity table needs to be joined, and suddenly there is a field ID?

  5. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,9 +234,34 @@ public function isFieldCaseSensitive($field_name) {
    +   * @param array $entity_tables
    +   *   A two dimensional array, the first is the name of a base or data table,
    +   *   the second is a column name.
    

    Two-dimensional array... what are the values and the keys? This is confusing. Especially it is confusing because there is a class member variable also called entityTables -- how is this related? What is it used for?

xjm’s picture

I just committed #2604722: Comment typo in BaseFieldDefinition.php file. Note that a better way of scoping these two issues would be to have:

  • one patch that fixes all the spelling errors that you have found, i.e. the patch that was committed plus those simple typo fixes from this patch (since that is a single conceptual scope of issue), and
  • a separate for adding the missing documentation, since reviewing that takes more work and requires more extensive review of a different nature, including actually examining the updated code.

That is easier to manage than different types of fixes in the same files/directories/etc.

Thanks for your contributions on these documentation issues! It's great to see all the improvements happening during the release candidate phase.

rakesh.gectcr’s picture

Issue summary: View changes

@xjm,

I have created the new issue only for the typo, https://www.drupal.org/node/2605264

this will continue for the only doc block , I will update issue summary too.

rakesh.gectcr’s picture

Title: Fixing typos and docblocks for core/lib/Drupal/Core/Entity » Fixing docblocks for core/lib/Drupal/Core/Entity
chx’s picture

> The first sentence here contradicts the examples. The sentence says it is a prefix for the table name. The examples are showing it as being a prefix for field names.

There's no contradiction: it is a table prefix based the relationship specifier and the latter is the the name of column containing the relationship . For example, author.uid. will be a prefix, that doesn't make it a prefix for field names,it's just based on something looking like a field name but it's not , it's a relationship specifier.

rakesh.gectcr’s picture

Assigned: rakesh.gectcr » Unassigned
aditya_anurag’s picture

Assigned: Unassigned » aditya_anurag
aditya_anurag’s picture

Assigned: aditya_anurag » Unassigned
Status: Needs work » Needs review
StatusFileSize
new3.91 KB
new3.89 KB

Changes done in patch.
As mentioned in comment #21
1. Changed to "Prefix that will be put on this table in queries, when it is used within this relationship."
2. Changed to "Field name for mapping with base table.".
3. Changed to "Base table name,the base table based on where it finds the $property first".
4. Changed to "This contains the relevant SQL field name to be used when joining entity tables"
5. Changed to "A two dimensional array, table name as key (base or data table) and array of column name as value of the respective table."

jhodgdon’s picture

Status: Needs review » Needs work
Issue tags: -rc eligible

Thanks for the patch, but it really needs some work... maybe go back to the previous patch and start over...

  1. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,9 +234,26 @@ public function isFieldCaseSensitive($field_name) {
    +   *   Prefix that will be put on this table in queries, when it is used within
    +   *   this relationship.
    

    So again, what is "this relationship" that is being discussed? All I know before I get to this line is that this function joins the entity table and returns an alias. Now suddenly we are talking about a relationship, and I do not know what this means. Maybe it should just say "join" instead of "relationship"?

    Also, this variable is called $index_prefix, why "index" in the name if it has nothing to do with indexes?

    And why "queries", when presumably it is just for one query?

  2. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,9 +234,26 @@ public function isFieldCaseSensitive($field_name) {
    +   *   Field name for mapping with base table.
    

    What does this mean?

  3. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,9 +234,26 @@ public function isFieldCaseSensitive($field_name) {
    +   *   Base table name,the base table based on where it finds the $property first
    

    This is unclear, and it needs to end in a . and be wrapped at 80 character lines.

  4. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,9 +234,26 @@ public function isFieldCaseSensitive($field_name) {
    +   *   This contains the relevant SQL field name to be used when joining entity
    +   *   tables.
    

    for which of the join parts?

  5. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -234,9 +234,26 @@ public function isFieldCaseSensitive($field_name) {
    +   *   A two dimensional array, table name as key (base or data table) and
    +   *   array of column name as value of the respective table.
    

    This is garbled.

  6. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -255,9 +272,25 @@ protected function ensureEntityTable($index_prefix, $property, $type, $langcode,
    +   *   Prefix that will be put on this table in queries, when it is used within
    +   *   this relationship.
    

    See above.

  7. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -255,9 +272,25 @@ protected function ensureEntityTable($index_prefix, $property, $type, $langcode,
    +   * @param object $field
    

    Really, it's a generic "object" and not a specific class?

  8. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -255,9 +272,25 @@ protected function ensureEntityTable($index_prefix, $property, $type, $langcode,
    +   *   A field object.
    

    Be more specific. What field object?

  9. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -255,9 +272,25 @@ protected function ensureEntityTable($index_prefix, $property, $type, $langcode,
    +   *   Base table name,the base table based on where it finds the $property first.
    

    garbled, unclear, I do not know what this means, and what is $property anyway?

    also more than 80 characters

  10. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -255,9 +272,25 @@ protected function ensureEntityTable($index_prefix, $property, $type, $langcode,
    +   * @param string $entity_id_field
    +   *   Either entity field ID value, or revision field ID value.
    +   * @param array $field_id_field
    +   *   Whether it is entity ID, or revision ID.
    

    These two params have the same name? And I don't understand what they mean.

  11. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -255,9 +272,25 @@ protected function ensureEntityTable($index_prefix, $property, $type, $langcode,
    +   *   Either entity field ID value, or revision field ID value.
    

    value for what?

  12. +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
    @@ -155,10 +155,13 @@ public function getFieldStorageDefinitions() {
    +   *   Defines an interface for cache implementations.
    

    No. We're not defining an interface, we're passing something in for a @param.

  13. +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
    @@ -155,10 +155,13 @@ public function getFieldStorageDefinitions() {
    +   * @internal param CacheBackendInterface $cache_backend
    

    What is this @internal thing?

aditya_anurag’s picture

Assigned: Unassigned » aditya_anurag
snehi’s picture

Assigned: aditya_anurag » snehi
rakesh.gectcr’s picture

@snehi, Can you please update the status on this ?

snehi’s picture

Assigned: snehi » Unassigned
no_angel’s picture

Assigned: Unassigned » no_angel
no_angel’s picture

Assigned: no_angel » Unassigned
no_angel’s picture

Issue tags: +Needs reroll

2601282-4.patch -> failed. Needs reroll

The last submitted patch, 18: 2601282-4.patch, failed testing.

no_angel’s picture

Assigned: Unassigned » no_angel
Issue summary: View changes

I'd like to give this a go, starting with re-roll of 10739450-4.patch

The last submitted patch, 18: 2601282-4.patch, failed testing.

no_angel’s picture

Issue tags: -Needs reroll
StatusFileSize
new5.96 KB

used bisect to re-roll 2601282-4a.patch.

no conflicts, auto merge.

So I think next steps is to work on the issue.

jhodgdon’s picture

That patch has a lot of interesting stuff in it that doesn't belong, like

+@@ -234,9 +234,34 @@ public function isFieldCaseSensitive($field_name) {
+   /**
+    * Join entity table if necessary and return the alias for it.
+    *
++   * @param string $index_prefix
++   *   Table name prefix to discern the same table used in several

etc.

no_angel’s picture

Assigned: no_angel » Unassigned
snehi’s picture

Status: Needs work » Needs review
StatusFileSize
new2.4 KB
new1.61 KB

Hows about it.

jhodgdon’s picture

Status: Needs review » Needs work

Please read the previous reviews before making a patch and setting the status to "Needs review". They still have not been addressed.

To be clear: I am still having a lot of problems with this documentation. Looking at the first function... (as noted at the top of #21 review as well as the #29 review), the first line docs say:

   /**
    * Join entity table if necessary and return the alias for it.

Then a lot of the @param docs start talking about relationships and fields, but there is no context for understanding what they are talking about, since all we have above that is "Join entity table if necessary".

So we really really need to add something to the documentation above the @params that explains what field/relationship we are talking about, before having param docs. They don't make any sense unless you already know something that is not in the documentation. Here are some examples of confusion I got when reading this method documentation:

+   * @param string $index_prefix
+   *   Prefix that will be put on this table in queries, when it is used within
+   *   this relationship.

What is "this relationship"? First I've heard of a relationship.

   * @param string $property
+   *   Mapped field table name.

What field? What is a "mapped field table name" anyway?

+   * @param string $base_table
+   *   Base table name.

What does "base table name" mean?

+   * @param string $id_field
+   *   Field name.

What field?

So this documentation is not making anything clear to me. The purpose of documentation of a method is to explain what the method does, and what it is used for. This documentation just leaves me with questions. I still have no idea what these methods are for.

tstoeckler’s picture

Issue tags: +DrupalBCDays

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

bisonbleu’s picture

Status: Needs work » Needs review
StatusFileSize
new9.53 KB

@jhodgdon, I have read and reread several times all comments/doc in /drupal/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php and I believe most of the questions you rightfully raised over the lack of context and the abundance of inferences have been addressed in a meaningful way since this thread went silent 4 years ago.

I think that being mostly a site-builder made me a good candidate/reader i.e. every inference sent me googling, so I learned a few things in the process. I also took the liberty to make a few changes that helped me better understand what's going on.

I hope you'll consider reviewing the attached patch and help me bring it to a state where it can be committed.

P.s. There are 2 TODOs in the patch, can someone help with those?

bisonbleu’s picture

StatusFileSize
new12.19 KB

After reading User interface standards, I went through one more time to apply the following rules:

  • Do not use the pronoun "we".
  • Do not use contractions, like "you've", "can't", and "shouldn't".

New patch is attcheed.

emyu01’s picture

Status: Needs review » Needs work

Little modifications to the patch. Adding a comma before the word 'then' in several places.

if ($key < $count) {
           $next = $specifiers[$key + 1];
-          // If this is a numeric specifier we're adding a condition on the
+          // If this is a numeric specifier, then add a condition on the
           // specific delta.
           if (is_numeric($next)) {
             $delta = $next;
@@ -151,7 +152,7 @@ public function addField($field, $type, $langcode) {
             $key++;
             $next = $specifiers[$key + 1];
           }
-          // If this specifier is the reserved keyword "%delta" we're adding a
+          // If this specifier is the reserved keyword "%delta", then add a
           // condition on a delta range.
@@ -227,7 +228,7 @@ public function addField($field, $type, $langcode) {
         // next one is a column of this field.
         if ($key < $count) {
           $next = $specifiers[$key + 1];
-          // If this specifier is the reserved keyword "%delta" we're adding a
+          // If this specifier is the reserved keyword "%delta", then add a
           // condition on a delta range.
           if ($next == TableMappingInterface::DELTA) {
             $key++;
@@ -238,9 +239,9 @@ public function addField($field, $type, $langcode) {
               return 0;
             }
           }
// If this is a numeric specifier we're adding a condition on the
-          // specific delta. Since we know that this is a single value base
-          // field no other value than 0 makes sense.
+          // If this is a numeric specifier, then add a condition on the
+          // specific delta. Since this is a single value base field, the only
+          // value that makes sense is 0.
TODO 1: If there exists both a field storage and a field column, check for case sensitivity.

TODO 2: Follows here attempts to state that "for data tables, the value of $langcode_key is retrieved from the $entity_type object while for other table types, $landcode_key = 'langcode' "

Hope this clears it.

neelam_wadhwani’s picture

Status: Needs work » Needs review
StatusFileSize
new1.72 KB
new12.2 KB

Hello @emyu01,

Done with comma modifications.
Kindly review patch.

emyu01’s picture

Status: Needs review » Needs work

Hi neelam_wadhwani,

Your patch does not apply cleanly because you will need to also take care of the TODOs specified in #53 which i have offered solutions in #55. They occur on lines 267 and 420 respectively. As an alternative, since the errors seem to be of different nature, we may remove the TODOs from current patch and fix them in a different issue entirely.

neslee canil pinto’s picture

Version: 8.8.x-dev » 8.9.x-dev
Status: Needs work » Needs review
StatusFileSize
new12.2 KB
new832 bytes

@emyu01 , there was a whitespace at line number 421, so it didn't got applied

emyu01’s picture

Version: 8.9.x-dev » 8.8.x-dev
Assigned: Unassigned » emyu01
Status: Needs review » Needs work

@Neslee you're right. I will just include the TODO fixes I suggested earlier.

emyu01’s picture

Assigned: emyu01 » Unassigned
Status: Needs work » Needs review
StatusFileSize
new12.12 KB
new1.62 KB

Here I have included both TODO fixes. kindly review.

joachim’s picture

Status: Needs review » Needs work
+++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
@@ -142,7 +143,7 @@ public function addField($field, $type, $langcode) {
-          // If this is a numeric specifier we're adding a condition on the
+          // If this is a numeric specifier, then add a condition on the
           // specific delta.
           if (is_numeric($next)) {
             $delta = $next;
@@ -151,7 +152,7 @@ public function addField($field, $type, $langcode) {

@@ -151,7 +152,7 @@ public function addField($field, $type, $langcode) {
             $key++;
             $next = $specifiers[$key + 1];
           }
-          // If this specifier is the reserved keyword "%delta" we're adding a
+          // If this specifier is the reserved keyword "%delta", then add a
           // condition on a delta range.

I don't think these changes are correct.

"If ... we're" is about deducing what the current intent of the method call is.

"If ... then" is about what the code is about to do.

Those are different concepts.

neslee canil pinto’s picture

Status: Needs work » Needs review
StatusFileSize
new10.82 KB
new1.36 KB

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

abhijith s’s picture

StatusFileSize
new41.72 KB

Patch can't be applied on 8.9.x.Needs reroll.

after

quietone’s picture

Version: 8.9.x-dev » 9.3.x-dev
Status: Needs review » Needs work
Issue tags: +Needs reroll, +Bug Smash Initiative

The reroll is suitable for a novice, keeping the tag.

leolandotan’s picture

Status: Needs work » Needs review
StatusFileSize
new10.49 KB
new7.82 KB

I have re-rolled the the patch from #62 to 8.9.x and included a re-roll interdiff as well. Tested also the new patch and it applied cleanly.

joachim’s picture

Status: Needs review » Reviewed & tested by the community

LGTM.

yogeshmpawar’s picture

Issue tags: -Needs reroll

Removing Needs reroll tag as it is no longer needed.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Issue tags: +Needs reroll

Needs a reroll again.

yogeshmpawar’s picture

Assigned: Unassigned » yogeshmpawar
yogeshmpawar’s picture

Assigned: yogeshmpawar » Unassigned
Issue tags: -Needs reroll
StatusFileSize
new10.51 KB

Rerolled the patch against 9.4.x branch.

yogeshmpawar’s picture

StatusFileSize
new10.38 KB
new1013 bytes

Updated patch with interdiff.

quietone’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs issue summary update

I read the IS and then skimmed the patch.

This patch is not fixing the problem stated in the Issue Summary. I think that problem was fixed in #2068655: Entity fields do not support case sensitive queries in 8.0.x. What is done here are improvements to the documentation in a single file, \Drupal\Core\Entity\Query\Sql\Tables, a file not mentioned in the Issue Summary.

Now looking at the patch more closely and found the following items.

  1. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -80,13 +80,14 @@ public function __construct(SelectInterface $sql_query) {
    +    // This variable ensures grouping works correctly. For example,
    +    // given the following conditions:
    

    This is not wrapped correctly.

  2. +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
    @@ -110,9 +111,9 @@ public function addField($field, $type, $langcode) {
    +      // Where there is revision support, only the current revisions are being
    

    This is a change from the original. Is this really only getting the current revision or all revisions?

I think this is a Task because it is improving the readability of the documentation, and cleanup such as expanding contractions and spacing so I think this is a task. However, there is one question, in the feedback above that needs to be answered before changing the category.

This really needs an Issue Summary update, adding tag. See Write an issue summary for an existing issue for guidance.

Leaving novice tag because updating this issue summary is a suitable for a first issue for someone.

vikashsoni’s picture

StatusFileSize
new68 bytes

@yogeshmpawar
patch is not applying in drupal9.3 going to skipping for ref sharing screenshot ....

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

rishabh064’s picture

Status: Needs work » Needs review
StatusFileSize
new10.38 KB
new876 bytes

Added fix for #74.1
Point number #74.2 still needs a fix.

rishabh064’s picture

Status: Needs review » Needs work

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Title: Fixing docblocks for core/lib/Drupal/Core/Entity » Improve some comments in \Drupal\Core\Entity\Query\Sql\Tables
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs issue summary update

@vikashsoni, @rishabh064, thanks for the interest in this issue. Your work here shows that you have not read the previous comment or the issue tags to find out what work needs to be done here. That just adds noise to the issue and work for others. So, no credit will be applied.

It has been two years since I asked for an issue summary update and it has not happened. I have opted to do so myself and create an MR.

quietone’s picture

@vikashsoni, @rishabh064, thanks for the interest in this issue. Your work here shows that you have not read the previous comment or the issue tags to find out what work needs to be done here. That just adds noise to the issue and work for others. So, no credit will be applied.

It has been two years since I asked for an issue summary update and it has not happened. I have opted to do so myself and create an MR.

smustgrave’s picture

Super nitpicky change to one sentence thoughts?

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Applied the change directly, not sure when the gitlab fix was pushed so we could edit MRs opened by committers but yay!

My change was so small don't mind marking, as rest looks fine.

  • nod_ committed fa5921b6 on 11.x
    Issue #2601282 by neslee canil pinto, rakesh.gectcr, yogeshmpawar,...

nod_’s picture

Title: Improve some comments in \Drupal\Core\Entity\Query\Sql\Tables » Improve comments in \Drupal\Core\Entity\Query\Sql\Tables
Status: Reviewed & tested by the community » Fixed

Committed fa5921b and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

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

xjm’s picture

Crediting myself for mentoring and scope guidance in #22.