lox / pheasant

A lightweight data mapper designed to take advantage of PHP 5.3+
http://getpheasant.com
MIT License
101 stars 21 forks source link

Testcase for broken (?) Schema::hash() #105

Closed bjornpost closed 10 years ago

bjornpost commented 10 years ago

I couldn't reproduce with the Hero/SecretIdentity example DomainObjects, so I've simplified the models which trigger the issue in our project and included them here (PHP 5.4 only, so this testcase might fail on 5.3).

Differences between Hero/SecretIdentity and Veldwerkdag/Project are the definition of the primary key (Sequence vs. Integer) and in the belongsTo relationship we define both local and foreign keys.

Please var_dump($schema->hash($object, array($this->local))) in Relationships/BelongsTo.php to see the issue. (Not sure how I could let the test fail on this)

bjornpost commented 10 years ago

@lox Are you able to reproduce the issue I'm seeing with this testcase?

bjornpost commented 10 years ago

ping @lox

bjornpost commented 10 years ago

Thanks! :+1:

bjornpost commented 10 years ago

Hmm, @lox, can you reopen this? Seems like the issue isn't fixed:

Questionnaire -- belongsTo (projectID, id) --> Project

Pheasant checks for Model\Project[id=x] in the cache. The key (id) is correct, but the value it checks for not. x is not the foreign value, but the local value.

For HasOne relationships the symptoms are exactly the other way around. The value it checks for is correct, but the key is not.

lox commented 10 years ago

I don't know why, but I can't seem to re-open this. Strange.

harto commented 10 years ago

See https://github.com/lox/pheasant/issues/109 instead. /cc @lox @bjornpost