Doctrine 1
  1. Doctrine 1
  2. DC-394

Searchable behavior's batchUpdateIndex fails if a table has a composite primary key.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.2.2
    • Component/s: Behaviors, Searchable
    • Labels:
      None

      Description

      You will get the following error when you try to batchUpdateIndex a table with composite key:

      Fatal error: Uncaught exception 'ErrorException' with message 'strpos() expects parameter 1 to be string, array given' in library/Doctrine/Connection.php:725

      Here's the full stack trace:

      Stack trace:
      #0 [internal function]: Bootstrap->errorHandler(2, 'strpos() expect...', '/Users/reko/Sit...', 725, Array)
      #1 /Users/reko/Sites/MyProject/library/Doctrine/Connection.php(725): strpos(Array, '.')
      #2 /Users/reko/Sites/MyProject/library/Doctrine/Search.php(246): Doctrine_Connection->quoteIdentifier(Array)
      #3 /Users/reko/Sites/MyProject/library/Doctrine/Template/Searchable.php(69): Doctrine_Search->batchUpdateIndex(NULL, NULL, NULL)
      #4 /Users/reko/Sites/MyProject/library/Doctrine/Template/Searchable.php(81): Doctrine_Template_Searchable->batchUpdateIndex(NULL, NULL, NULL)
      #5 [internal function]: Doctrine_Template_Searchable->batchUpdateIndexTableProxy()
      #6 /Users/reko/Sites/MyProject/library/Doctrine/Record.php(2622): call_user_func_array(Array, Array)
      #7 [internal function]: Doctrine_Record->__call('batchUpdateInde...', Array)
      #8 [internal function]: In in /Users/reko/Sites/MyProject/library/Doctrine/Connection.php on line 725

      I know that it's recommended that you don't use composite primary keys, but this happens to occur when you stack the I18n and Searchable behaviour together, since the Translation table I18n behavior creates uses a composite key on (id, lang).

      Anyways, the bug was quite simple one to fix and I've attached a patch that fixes the issue.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Reko Tiira
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: