Fix: some isVersionningNecessary() calls can cause fatal errors #314

Merged
merged 1 commit into from Mar 14, 2012

Conversation

Projects
None yet
2 participants
Contributor

K-Phoen commented Mar 14, 2012

Given the following model, some isVersionningNecessary() calls would cause
fatal errors.

User                              Group
----                              -----
name                              name
group_id [FK, not required]

When saving an user with no group but a name, the isVersioningNecessary()
method returns true because the object is modified. But if we save again the
same user - as there are no modifications on the user - the foreign keys
are checked and isVersioningNecessary() is called on them, which causes
a fatal error when one of them is not set.

In fact, calling isVersioningNecessary() on any not-new, not modifiable object, with null foreign keys will cause a fatal error.

@K-Phoen K-Phoen Fix: some isVersionningNecessary() calls can cause fatal errors
Given the following model, some isVersionningNecessary() calls would cause
fatal errors.

    User                              Group
    ----                              -----
    name                              name
    group_id [FK, not required]

When saving an user with no group but a name, the isVersioningNecessary()
method returns true because the object is modified. But if we save again the
same user - as there are no modifications on the user - the foreign keys
are checked and isVersioningNecessary() is called on them, which causes
a fatal error when one of them is not set.
eb303e5

@willdurand willdurand added a commit that referenced this pull request Mar 14, 2012

@willdurand willdurand Merge pull request #314 from K-Phoen/fix-is-versionning-necessary-fk
Fix: some isVersionningNecessary() calls can cause fatal errors
b7669e3

@willdurand willdurand merged commit b7669e3 into propelorm:master Mar 14, 2012

Owner

willdurand commented Mar 14, 2012

Thanks!
Kevin, can you port this patch on Propel2 as well?

Contributor

K-Phoen commented Mar 15, 2012

Sure, it will be done today or tomorrow afternoon :)

K-Phoen referenced this pull request in propelorm/Propel2 Mar 16, 2012

Merged

Port PR #314 from Propel 1.6 #153

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment