• Aaron Wells's avatar
    Make Collection::save() play well with existing collections & non-null columns · 1f779bdd
    Aaron Wells authored
    Bug 1381811: Collection::save() would create a new (empty) collection by
    passing 0 as the id to the Collection constructor, even if the supplied
    $data included an "id" field. Since the id was not supplied to the
    constructor, it does not pull the collection's current data from the
    database.
    
    It would then call Collection->commit(), which would notice the "id"
    field and do an update instead of an insert into the database. But due to
    the way the Collection class is written, it would try to populate every
    field of the collection table, rather than just those supplied in $data.
    
    This means that all the database fields not supplied in $data, would
    attempt to be filled with NULL. This threw an error because of the new
    collection.submittedstatus NOT-NULL column.
    
    Change-Id: I6a2927892459bd25d51bd58de1bd3e3584df0793
    1f779bdd