class Model_Plan extends \Orm\ModelWhen I tried to delete a node from Model_Plan, I got a "No changes allowed" error.
{
protected static $_has_many = array(
'subscriptions' => array(
'model_to' => 'Model_Subscription',
'key_from' => 'id',
'key_to' => 'plan_id',
),
);
}
class Model_Subscription extends \Orm\Model
{
protected static $_belongs_to = array(
'plan' => array(
'key_from' => 'plan_id',
'model_to' => 'Model_Plan',
'key_to' => 'id',
),
);
}
$plan = Model_Plan::query()->where("id", 2)->related("subscriptions")->get_one();This, however, threw the error:
$plan->delete();
$plan = Model_Plan::query()->where("id", 2)->get_one();
$plan->delete();
public static function _init()
{
if ( $plans = \Model_Plan::query()->where("active", 1)->get() )
{
foreach ($plans as $i => $plan) {
static::$_properties["plan_id"]["form"]["options"][$plan->id] = $plan->name;
}
}
}
Uncaught exception Orm\FrozenObject: No changes allowed.
Callstack:
#0 /home/chad/scraper/fuel/packages/orm/classes/query.php(1086): Orm\Model->_relate()
#1 /home/chad/scraper/fuel/packages/orm/classes/query.php(1174): Orm\Query->hydrate(Array, Array, Array, 'Model_Plan', Array, Array)
#2 /home/chad/scraper/fuel/app/classes/model/subscription.php(7): Orm\Query->get()
#3 [internal function]: Model_Subscription::_init()
#4 /home/chad/scraper/fuel/core/classes/autoloader.php(364): call_user_func('Model_Subscript...')
#5 /home/chad/scraper/fuel/core/classes/autoloader.php(283): Fuel\Core\Autoloader::init_class('Model_Subscript...')
#6 [internal function]: Fuel\Core\Autoloader::load('Model_Subscript...')
#7 [internal function]: spl_autoload_call('Model_Subscript...')
#8 /home/chad/scraper/fuel/packages/orm/classes/hasmany.php(37): class_exists('Model_Subscript...')
#9 /home/chad/scraper/fuel/packages/orm/classes/model.php(381): Orm\HasMany->__construct('Model_Plan', 'subscriptions', Array)
#10 /home/chad/scraper/fuel/packages/orm/classes/model.php(1335): Orm\Model::relations()
#11 /home/chad/scraper/fuel/app/migrations/028_seed_plans.php(28): Orm\Model->delete()
#12 [internal function]: Fuel\Migrations\Seed_plans->down()
#13 /home/chad/scraper/fuel/core/classes/migrate.php(283): call_user_func(Array)
#14 /home/chad/scraper/fuel/core/classes/migrate.php(254): Fuel\Core\Migrate::run(Array, 'default', 'app', 'down')
#15 /home/chad/scraper/fuel/core/tasks/migrate.php(315): Fuel\Core\Migrate::down(NULL, 'default', 'app')
#16 /home/chad/scraper/fuel/core/tasks/migrate.php(150): Fuel\Tasks\Migrate::_down('default', 'app')
#17 [internal function]: Fuel\Tasks\Migrate->__call('down', Array)
#18 [internal function]: Fuel\Tasks\Migrate->down()
#19 /home/chad/scraper/fuel/packages/oil/classes/refine.php(101): call_user_func_array(Array, Array)
#20 [internal function]: Oil\Refine::run('migrate:down', Array)
#21 /home/chad/scraper/fuel/packages/oil/classes/command.php(114): call_user_func('Oil\Refine::run', 'migrate:down', Array)
#22 /home/chad/scraper/oil(57): Oil\Command::init(Array)
#23 {main}
It looks like you're new here. If you want to get involved, click one of these buttons!