protected function enforce_dependencies() {
        // Get the plan.
        $plan = $this->controller->get_plan();
        // Get the tasks as a var so we can iterate by reference.
        $tasks = $plan->get_tasks();
        $changes = 0;
        foreach ($tasks as &$task) {
            // Store as a var so we can iterate by reference.
            $settings = $task->get_settings();
            foreach ($settings as &$setting) {
                // Get all dependencies for iteration by reference.
                $dependencies = $setting->get_dependencies();
                foreach ($dependencies as &$dependency) {
                    // Enforce each dependency.
                    if ($dependency->enforce()) {
                        $changes++;
                    }
                }
            }
        }
        // Store the number of settings that changed through enforcement.
        $this->dependencychanges = $changes;
        return ($changes > 0);
    }
protected function enforce_dependencies() {
        // Get the plan.
        $plan = $this->controller->get_plan();
        // Get the tasks as a var so we can iterate by reference.
        $tasks = $plan->get_tasks();
        $changes = 0;
        foreach ($tasks as &$task) {
            // Store as a var so we can iterate by reference.
            $settings = $task->get_settings();
            foreach ($settings as &$setting) {
                // Get all dependencies for iteration by reference.
                $dependencies = $setting->get_dependencies();
                foreach ($dependencies as &$dependency) {
                    // Enforce each dependency.
                    if ($dependency->enforce()) {
                        $changes++;
                    }
                }
            }
        }
        // Store the number of settings that changed through enforcement.
        $this->dependencychanges = $changes;
        return ($changes > 0);
    }
protected function enforce_dependencies ( ) { // Get the plan. $ plan = $ this -> controller -> get_plan ( ) ; // Get the tasks as a var so we can iterate by reference. $ tasks = $ plan -> get_tasks ( ) ; $ changes = 0 ; foreach ( $ tasks as & $ task ) { // Store as a var so we can iterate by reference. $ settings = $ task -> get_settings ( ) ; foreach ( $ settings as & $ setting ) { // Get all dependencies for iteration by reference. $ dependencies = $ setting -> get_dependencies ( ) ; foreach ( $ dependencies as & $ dependency ) { // Enforce each dependency. if ( $ dependency -> enforce ( ) ) { $ changes ++ ; } } } } // Store the number of settings that changed through enforcement. $ this -> dependencychanges = $ changes ; return ( $ changes > 0 ) ; }
Enforces dependencies on all settings. Call before save
@return bool True if dependencies were enforced and changes were made
Enforces dependencies on all settings . Call before save