Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-385

Null need set to NULL in array type

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Can't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      When use Array type and NULL value

      set null give in database 'N;' (serialise(null))
      need NULL

        Activity

        Hide
        Benjamin Eberlei added a comment -

        This would be a BC Break and cannot be done anymore. You can add your own array type that has this behavior.

        Show
        Benjamin Eberlei added a comment - This would be a BC Break and cannot be done anymore. You can add your own array type that has this behavior.
        Hide
        Ivan Borzenkov added a comment -

        It will not be a loss of backward compatibility.
        Now if we have an empty array, that is stored serialized NULL, but the default value for NULL instead of N;
        On the part of php will not be any differences - the inverse transform is the same, from the database, we combined the two into a single value, the more accurate in terms of DB

        Show
        Ivan Borzenkov added a comment - It will not be a loss of backward compatibility. Now if we have an empty array, that is stored serialized NULL, but the default value for NULL instead of N; On the part of php will not be any differences - the inverse transform is the same, from the database, we combined the two into a single value, the more accurate in terms of DB
        Hide
        Benjamin Eberlei added a comment -

        The field might be NOT NULL, that is what might break BC.

        Show
        Benjamin Eberlei added a comment - The field might be NOT NULL, that is what might break BC.
        Hide
        Ivan Borzenkov added a comment -

        and if field is null?

         
        
        /**
         * @var array $yandexReg
         *
         * @ORM\Column(name="yandexReg", type="array", nullable=true)
         */
        private $yandexReg;
        
        
        Show
        Ivan Borzenkov added a comment - and if field is null? /** * @ var array $yandexReg * * @ORM\Column(name= "yandexReg" , type= "array" , nullable= true ) */ private $yandexReg;
        Hide
        Benjamin Eberlei added a comment -

        Well in this case it works obviously, however the Type API doesn't have access to that information. Thats why I meant you should build your own array type and override the internal implementation. This is explained in the Mapping Fields Document of ORM and in the Type Documentation of DBAL.

        Show
        Benjamin Eberlei added a comment - Well in this case it works obviously, however the Type API doesn't have access to that information. Thats why I meant you should build your own array type and override the internal implementation. This is explained in the Mapping Fields Document of ORM and in the Type Documentation of DBAL.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Ivan Borzenkov
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: