Skip to content
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

problem with GridFieldAddExistingSearchButton and Fluent #356

Open
RoyalPulp opened this issue Feb 7, 2023 · 1 comment
Open

problem with GridFieldAddExistingSearchButton and Fluent #356

RoyalPulp opened this issue Feb 7, 2023 · 1 comment

Comments

@RoyalPulp
Copy link

Hello there :)

I just found the GridFieldAddExistingSearchButton as a useful alternative to the deprecated MultiSelectField for many_many relations.
Unfortunately I don't get the search functionality to work on websites with Fluent Extension (tried it successfully on 2 Projects without multilanguage/Fluent module - but no success with 2 projects that use Fluent Module)

Page <-> many_many <-> SeitenLink Objects

Here the full error message - I hope somebody can interpret it in relation with the module code

The term "LIK" looks a bit strange to me (right at the end of the SQL ).. maybe the string isn't complete??

error-log.ERROR: Uncaught Exception SilverStripe\ORM\Connect\DatabaseException: "Couldn't run query: SELECT CASE WHEN EXISTS SELECT * FROM "SeitenLink" LEFT JOIN "SeitenLink_Localised" AS "SeitenLink_Localised_de_DE" ON "SeitenLink"."ID" = "SeitenLink_Localised_de_DE"."RecordID" AND "SeitenLink_Localised_de_DE"."Locale" = ? WHERE () AND (COALESCE("SeitenLink_Localised_de_DE"."Title", "SeitenLink"."Title") LIKE ?) AND ("SeitenLink"."ID" NOT IN SELECT DISTINCT "SeitenLink"."ID" FROM "SeitenLink" INNER JOIN "Page_SeitenLinks" ON "Page_SeitenLinks"."SeitenLinkID" = "SeitenLink"."ID" LEFT JOIN "SeitenLink_Localised" AS "SeitenLink_Localised_de_DE" ON "SeitenLink"."ID" = "SeitenLink_Localised_de_DE"."RecordID" AND "SeitenLink_Localised_de_DE"."Locale" = ? WHERE ("Page_SeitenLinks"."PageID" = ?)))) THEN 1 ELSE 0 END SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND (COALESCE("SeitenLink_Localised_de_DE"."Title", "SeitenLink"."Title") LIK' at line 3" at (...)/vendor/silverstripe/framework/src/ORM/Connect/DBConnector.php line 64 {"exception":"[object] (SilverStripe\\ORM\\Connect\\DatabaseException(code: 0): Couldn't run query:\n\nSELECT CASE WHEN EXISTS\nSELECT *\n\nFROM \"SeitenLink\"\nLEFT JOIN \"SeitenLink_Localised\" AS \"SeitenLink_Localised_de_DE\" ON \"SeitenLink\".\"ID\" = \"SeitenLink_Localised_de_DE\".\"RecordID\" AND \"SeitenLink_Localised_de_DE\".\"Locale\" = ?\n\nWHERE ()\n AND (COALESCE(\"SeitenLink_Localised_de_DE\".\"Title\", \"SeitenLink\".\"Title\") LIKE ?)\n AND (\"SeitenLink\".\"ID\" NOT IN \nSELECT DISTINCT \"SeitenLink\".\"ID\"\n\nFROM \"SeitenLink\"\nINNER JOIN \"Page_SeitenLinks\" ON \"Page_SeitenLinks\".\"SeitenLinkID\" = \"SeitenLink\".\"ID\"\nLEFT JOIN \"SeitenLink_Localised\" AS \"SeitenLink_Localised_de_DE\" ON \"SeitenLink\".\"ID\" = \"SeitenLink_Localised_de_DE\".\"RecordID\" AND \"SeitenLink_Localised_de_DE\".\"Locale\" = ?\n\nWHERE (\"Page_SeitenLinks\".\"PageID\" = ?)))) THEN 1 ELSE 0 END\n\nSQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')\n AND (COALESCE(\"SeitenLink_Localised_de_DE\".\"Title\", \"SeitenLink\".\"Title\") LIK' at line 3 at (...)/vendor/silverstripe/framework/src/ORM/Connect/DBConnector.php:64)"} []
Thank You all!

@MLindenhofer
Copy link

MLindenhofer commented Mar 13, 2023

I have the same problem with GridFieldAddExistingSearchButton & Fluent. In my case it's

NewsElement <-> many_many <-> BlogPosts (silverstripe-blog-module)

CMS 4.12,
Fluent 5.1.1

Can you please check, what's going on? Thanks so much in advance.

ErrorMessage:

[Emergency] Uncaught SilverStripe\ORM\Connect\DatabaseException: Couldn't run query:



        SELECT CASE WHEN EXISTS

        SELECT *



        FROM "SiteTree"

        LEFT JOIN "Page" ON "Page"."ID" = "SiteTree"."ID"

        LEFT JOIN "News_Post" ON "News_Post"."ID" = "SiteTree"."ID"

        LEFT JOIN "SiteTree_Localised" AS "SiteTree_Localised_de_AT" ON "SiteTree"."ID" = "SiteTree_Localised_de_AT"."RecordID" AND "SiteTree_Localised_de_AT"."Locale" = ?

        LEFT JOIN "Page_Localised" AS "Page_Localised_de_AT" ON "Page"."ID" = "Page_Localised_de_AT"."RecordID" AND "Page_Localised_de_AT"."Locale" = ?

        LEFT JOIN "News_Post_Localised" AS "News_Post_Localised_de_AT" ON "News_Post"."ID" = "News_Post_Localised_de_AT"."RecordID" AND "News_Post_Localised_de_AT"."Locale" = ?



        WHERE ()

         AND (COALESCE("SiteTree_Localised_de_AT"."Title", "SiteTree"."Title") LIKE ?)

         AND ("SiteTree"."ID" NOT IN 

        SELECT DISTINCT "SiteTree"."ID"



        FROM "SiteTree"

        LEFT JOIN "Page" ON "Page"."ID" = "SiteTree"."ID"

        LEFT JOIN "News_Post" ON "News_Post"."ID" = "SiteTree"."ID"

        INNER JOIN "NewsElement_NewsPosts" ON "NewsElement_NewsPosts"."News_PostID" = "SiteTree"."ID"

        LEFT JOIN "SiteTree_Localised" AS "SiteTree_Localised_de_AT" ON "SiteTree"."ID" = "SiteTree_Localised_de_AT"."RecordID" AND "SiteTree_Localised_de_AT"."Locale" = ?

        LEFT JOIN "Page_Localised" AS "Page_Localised_de_AT" ON "Page"."ID" = "Page_Localised_de_AT"."RecordID" AND "Page_Localised_de_AT"."Locale" = ?

        LEFT JOIN "News_Post_Localised" AS "News_Post_Localised_de_AT" ON "News_Post"."ID" = "News_Post_Localised_de_AT"."RecordID" AND "News_Post_Localised_de_AT"."Locale" = ?



        WHERE ("NewsElement_NewsPosts"."NewsElementID" = ?)

         AND ("SiteTree"."ClassName" IN (?, ?, ?, ?, ?, ?, ?))))

         AND ("SiteTree"."ClassName" IN (?, ?, ?, ?, ?, ?, ?))) THEN 1 ELSE 0 END



        SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')

         AND (COALESCE("SiteTree_Localised_de_AT"."Title", "SiteTree"."Title") LIKE...' at line 3</h1>

        <h3>GET /admin/pages/edit/EditForm/1/field/ElementalArea/item/190/ItemEditForm/field/NewsPosts/add-existing-search/SearchForm/?q=&amp;Title=tanium&amp;Content=&amp;Type=&amp;SecurityID=4de3293b2c2b0d49a6f682d1cd8113ef591c66c3</h3>

        <p>

            Line 

            <strong>64</strong>

             in 

            <strong>/Volumes/projects/bacher/vendor/silverstripe/framework/src/ORM/Connect/DBConnector.php</strong>```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants