{"commits":[{"author":{"name":"Fabien Potencier","email":"d4f8dcd89cfe40276c0fbf336903f4a05ab082c9@gmail.com"},"sha":"7c8d836331cc73863fe2ff346ad8c85202073d79","message":"merged branch willdurand/undefined-value-property-path (PR #2266)\n\nCommits\n-------\n\n57e1aeb Fixed undefined index notice in readProperty() method (PropertyPath)\n\nDiscussion\n----------\n\nFixed undefined index notice in readProperty() method (PropertyPath)\n\nHi,\n\nFor some reasons, I get `notice` errors on `readProperty()` with Propel:\n\n    Notice: Undefined index: 0 in /Users/william/projects/Propel/testProjects/symfony2/vendor/symfony/src/Symfony/Component/Form/Util/PropertyPath.php line 284\n\nThe `PropelObjectCollection` implements `ArrayAccess`, the `readProperty()` method does not check if the given `index` exists so the `notice` error is thrown. I suppose to check whether the index exists or not has to be added.\n\nRegards,\nWilliam\n\n---------------------------------------------------------------------------\n\nby fabpot at 2011/09/27 23:42:07 -0700\n\nThe patch is probably not what we want to do. First, I suppose that you are not creating the propertyPath by hand. If that is the case, we need to understand why the property path does not exist. Then, even if we might want to check the existence of the index, if it does not exist, we should probably throw an exception instead of just ignoring the problem.\n\n---------------------------------------------------------------------------\n\nby willdurand at 2011/09/28 01:14:49 -0700\n\nMy bad. This is a Propel bug due to `ArrayObject`. It throws a notice error if the index is not found in `offsetGet()` which is wrong according to the `ArrayAccess` interface. If the index is not found, we have to return `null`.\n\n@fabpot Are you agree with that (for the `null` value) ?\n\n---------------------------------------------------------------------------\n\nby fabpot at 2011/09/28 01:17:09 -0700\n\nMy point is that it should never happen under normal circumstances.\n\n---------------------------------------------------------------------------\n\nby willdurand at 2011/09/28 01:23:55 -0700\n\n@fabpot Not sure to get it.\n\nThe fact is that it tries to get the value (`getValue()`) of a fresh object, just added to the `collection` when I'm submitting a form with a `CollectionType` and a new entry in it.\nI mean it tries to get this new object (not yet persisted, not yet in the collection) in the collection (`getValue()` -> `readProperty()`) which implements `ArrayAccess` but this object cannot be in the collection at this time.\n\nAm I wrong ?\n\nAnd, without this notice error thrown by Propel, I probably never opened this issue...\n\n---------------------------------------------------------------------------\n\nby willdurand at 2011/09/29 06:40:34 -0700\n\n@fabpot: you can try this example: http://www.propelorm.org/cookbook/symfony2/mastering-symfony2-forms-with-propel.html#manytomany_relations in order to make your own tests. Will it be enough?\nAs I said, it throws a weird notice for the reasons above.\n\n---------------------------------------------------------------------------\n\nby jaugustin at 2011/10/04 12:58:10 -0700\n\nany news on this ?\n@fabpot did you have time to look at the test case ?\n\n---------------------------------------------------------------------------\n\nby cedriclombardot at 2011/11/09 14:29:42 -0800\n\n@fabpot: can we have news about this ?","url":"https://api.github.com/repos/symfony/symfony/commits/7c8d836331cc73863fe2ff346ad8c85202073d79"}],"ref":"refs/heads/2.0","head":"7c8d836331cc73863fe2ff346ad8c85202073d79","size":1,"push_id":50950191}