Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Bug with MultiModel code #44

Open
acorncom opened this Issue · 0 comments

1 participant

acorncom
acorncom

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

Code:
```if($attributes['type'] == self::NORMAL_CLIENT)
$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:
```if($attributes['type'] == self::NORMAL_CLIENT)
       $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 join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.