Variable undefined in Localhost, works on server

225 Views Asked by At

I was given a project to update certain extensions and modules on without any documentation.

The issue I'm having is for one of the variables in the model, it is being regarded as not defined when using localhost (but works fine on the server version which is the exact same code).

From what I can see, it makes a single row in the database and assigns it a value of 1 or 0.

What could be causing this?

Keep in mind, this works fine on the server. I have turned global variables in my php.ini to On. No change. The Row is definitely created and exists in the database with a value. The page errors out after clicking "create new group".

Edit. Error message : Property "EventGroups.delegates_select_event_group " is not defined.

Code below is the model, controller and form. (and the options)

First off, the form view.

echo $form->switchGroup($model, 'delegates_select_event_group', array('class' => 'col-md-6'));

Model

public $delegates_select_event_group;

public function rules() {
        // NOTE: you should only define rules for those attributes that
        // will receive user inputs.
        return array(

            array('name, description, guest_invites_per_user, delegates_select_event_group ', 'required'),

        );
    }

Options

//Options
// Event group selectable

const KEY_DELEGATES_SELECT_EVENT_GROUP = 'delegates_select_event_group';

public static function isDelegatesSelectEventGroup() {
    return self::getValue(self::KEY_DELEGATES_SELECT_EVENT_GROUP, false);
}

public static function setDelegatesSelectEventGroup($value) {
    return self::setValue(self::KEY_DELEGATES_SELECT_EVENT_GROUP, $value);
}

const KEY_DEFAULT_EVENT_GROUP_ID = 'default_event_group_id';

public static function getDefaultEventGroupID() {
    $model = EventGroups::model()->find();
    if ($model === null) {
        return self::getValue(self::KEY_DEFAULT_EVENT_GROUP_ID, 1);
    } else {
        return self::getValue(self::KEY_DEFAULT_EVENT_GROUP_ID, $model->id);
    }
}

public static function setDefaultEventGroupID($value) {
    return self::setValue(self::KEY_DEFAULT_EVENT_GROUP_ID, $value);
}

Controller

public function actionCreate() {
        $model = new EventGroups;

        // Uncomment the following line if AJAX validation is needed
        $this->performAjaxValidation($model);

        if (isset($_POST['EventGroups'])) {
            $model->attributes = $_POST['EventGroups'];

            if ($model->validate()) {
                // Valid Save 
                $model->save(false);
                $this->redirect(array('event/create'));
            }
        }

    $this->render('create', array(
        'model' => $model,
    ));
}
0

There are 0 best solutions below