You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if a model (which inherits from parent one) changes the schema all find()-methods work fine, but update() fails. It uses the parent set schema, not its own.
my code example:
class parentModel extends \Phalcon\Mvc\Model {
publicstatic$database = 'blah';
publicstatic$source = '';
publicfunctioninitialize() {
$this->setConnectionService('db');
$this->setSchema(static::$database);
$this->setSource(static::$source);
}
}
class childModel extends parentModel {
publicstatic$database = 'rumble';
publicstatic$source = 'jungle';
publicfunctioninitialize() {
parent::initialize();
$this->useDynamicUpdate(true);
}
}
// create a child, modify it and save the changes.// simple, isn't it?$object = childModel::findFirst("where ...");
$object->something = 'stupid';
$object->update();
result: Error on save model Models\parentModel
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'blah.jungle' doesn't exist
So: the table was used correctly, the database (schema) not. It uses the parent model to save...
The text was updated successfully, but these errors were encountered:
swen100
changed the title
version 1.3.4: $inherited_model->update() fails because of (wrong) schema used from parent
$inherited_model->update() fails because it uses wrong schema (from parent)
Nov 13, 2014
swen100
changed the title
$inherited_model->update() fails because it uses wrong schema (from parent)
Model::update() fails because it uses wrong schema (from parent)
Nov 13, 2014
swen100
changed the title
Model::update() fails because it uses wrong schema (from parent)
inherited Model::update() fails because it uses wrong schema (from parent)
Nov 13, 2014
swen100
changed the title
inherited Model::update() fails because it uses wrong schema (from parent)
[1.3.4] inherited Model::update() fails because it uses wrong schema (from parent)
Nov 13, 2014
swen100
changed the title
[1.3.4] inherited Model::update() fails because it uses wrong schema (from parent)
[1.3.4] inherited ChildModel::update() fails because it uses wrong schema (from parent)
Nov 13, 2014
if a model (which inherits from parent one) changes the schema all find()-methods work fine, but update() fails. It uses the parent set schema, not its own.
my code example:
result:
Error on save model Models\parentModel
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'blah.jungle' doesn't exist
So: the table was used correctly, the database (schema) not. It uses the parent model to save...
another interesting thing:
gives: 'rumble' , which is correct.
maybe it is related to #2415
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: