Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-866

Foreign Key Constraints does not work with Doctrine/Symfony and SQLite

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.4.2
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None
    • Environment:
      PHP 5.5.9, SQLite3 module version 0.7-dev, SQLite Library 3.8.3.1

      Description

      I have posted a question on stackoverflow already to get help on this issue, but nobody could give me a sufficient answer. See here.

      #370 says that support for foreign keys support for SQLite has been implemented. But in my case it does not work. I have defined two entities:

      Unable to find source-code formatter for language: yaml. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
      Category:
          type: entity
          id:
              id:
                  type: integer
                  id: true
                  generator:
                      strategy: AUTO
          oneToMany:
              ministries:
                  targetEntity: Ministry
                  cascade: [persist]
                  mappedBy: category
      

      And

      Unable to find source-code formatter for language: yaml. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
      Ministry:
          type: entity
          id:
              id:
                  type: integer
                  id: true
                  generator:
                      strategy: AUTO
          manyToOne:
              category:
                  targetEntity: Category
                  inversedBy: ministries
                  joinColumn:
                      name: category_id
                      nullable: false
                      onDelete: CASCADE
      

      But when I delete a category, the ministry entities do not get deleted, although the constraint should cascade. What am I missing?

      Do I have to configure anything to get that working or is it a bug?

        Activity

        Hide
        Marco Pivetta added a comment -

        While some FK functionalities are supported by the DBAL, I reverted the feature in https://github.com/doctrine/dbal/commit/7282289fee625a24c26c1fccc0474e8ca583470f since it was too clunky, so the ORM doesn't recognize the platform as a platform that supports FKs.

        Show
        Marco Pivetta added a comment - While some FK functionalities are supported by the DBAL, I reverted the feature in https://github.com/doctrine/dbal/commit/7282289fee625a24c26c1fccc0474e8ca583470f since it was too clunky, so the ORM doesn't recognize the platform as a platform that supports FKs.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Christian S.
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: