Doctrine MongoDB ODM
  1. Doctrine MongoDB ODM
  2. MODM-50

GridFs file classes don't support inheritance

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.0BETA1
    • Component/s: None
    • Labels:
      None

      Description

      GridFs files do not support inheritance anymore. This issue only appeared after latest updates from git. It was working before.

      Here is a test case:

      /**
       * @Document(collection="files", db="tests")
       * @InheritanceType("SINGLE_COLLECTION")
       * @DiscriminatorField(fieldName="type")
       * @DiscriminatorMap({
       *      "file"="file",
       *      "image"="image"
       * })
       */
      class file
      {
          /** @Id */
          protected $id;
      
          /** @File */
          protected $file;
      
          function __construct($file) {$this->file = $file;}
      }
      
      /** @Document(collection="files", db="tests") */
      class image extends file
      {
          /** @File */
          protected $file;
      }
      
      $a = new image(__DIR__ . '/test.txt');
      $dm->persist($a);
      $dm->flush();
      

      This code creates document in regular collection "files" instead of GridFs collection.

        Activity

        Show
        Jonathan H. Wage added a comment - Thanks for the issue! Fixed by http://github.com/doctrine/mongodb-odm/commit/3830635986a288235c46e198b7170d959ce37647
        Hide
        Vladimir Razuvaev added a comment -

        Thanks for quick fixes!

        I also found other weird issue, will create separate case for it.

        Show
        Vladimir Razuvaev added a comment - Thanks for quick fixes! I also found other weird issue, will create separate case for it.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Vladimir Razuvaev
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: