Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

Bug with MultiModel code #44

Open
acorncom opened this issue May 21, 2011 · 0 comments
Open

Bug with MultiModel code #44

acorncom opened this issue May 21, 2011 · 0 comments

Comments

@acorncom
Copy link

On this page: http://canni.github.com/YiiMongoDbSuite/xhtml/special.multimodel.html

Code:

       $model = new NormalClient(null); // We have to set scenario to null, it will be set, by populateRecord, later
        else if($attributes['type'] == self::BUSINESS_CLIENT)
            $model = new BusinessClient(null);

should be:

Code:

       $model = new NormalClient(null); // We have to set scenario to null, it will be set, by populateRecord, later
        else if($attributes['type'] === self::BUSINESS_CLIENT) <-- changed
            $model = new BusinessClient(null);
        else <-- added
            $model = new Client(null); <-- added

It's needed so that if we're calling delete on a model (using it's Pk), it doesn't try to add in a type value as well. The == was assuming that type = 0 where it was really being sent a blank line.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant