You wrote this:
$this->data['ArvcProfile']['minor_criteria'] == $minor;
$this->data['ArvcProfile']['major_criteria'] ==
$major;
if ($major > 1 || ($major == 1 && $minor > 1) ||
($minor > 3)) {
$this->data['ArvcProfile']
['criteria_fulfilled'] == 1;
}
I think you meant this:
$this->data['ArvcProfile']['minor_criteria'] = $minor;
$this->data['ArvcProfile']['major_criteria'] = $major;
if ($major > 1 || ($major == 1 && $minor > 1) ||
($minor > 3)) {
$this->data['ArvcProfile']
['criteria_fulfilled'] = 1;
}
This sort of typo is frequent the other way around (using = instead of
==) and can lead to major hair loss. This way around, I haven't seen
so much
hth
grigri
On Jan 13, 4:51 pm, Kanten <[email protected]> wrote:
> Hi,
>
> I'm trying to do some beforesave massaging in my model but it fails
> with the error messages:
> Notice (8): Undefined index: minor_criteria [APP/models/
> arvc_profile.php, line 32]
> Notice (8): Undefined index: major_criteria [APP/models/
> arvc_profile.php, line 33]
> Notice (8): Undefined index: criteria_fulfilled [APP/models/
> arvc_profile.php, line 36]
>
> The threes indexes are not a part of the form, from which the data is
> derived, but are in the database table, and hence I thought I would be
> able to manipulate them in my model. My BeforeSave function can be
> seen below.
>
> Anyone know what I am doing wrong here.
>
> function beforeSave() {
> /* Calculates no of major and minor ARVC criterias */
> $minor = 0;
> $major = 0;
> $total = 0;
> $groups = array();
> if($this->data['ArvcProfile']['rv_sev_dilatation'] == 1)
> {$major++;}
> if($this->data['ArvcProfile']['rv_aneurysms'] == 1)
> {$major++;}
> if($this->data['ArvcProfile']['rv_sev_seg_dilatation'] == 1)
> {$major+
> +;}
> if($this->data['ArvcProfile']['rv_mild_dilatation'] == 1)
> {$minor++;
> $groups[]=1;}
> if($this->data['ArvcProfile']['rv_mild_seg_dilatation'] == 1)
> {$minor
> ++; $groups[]=1;}
> if($this->data['ArvcProfile']['rv_reg_hypokinesia'] == 1)
> {$minor++;
> $groups[]=1;}
> if($this->data['ArvcProfile']['fibrofatty_replacement'] == 1)
> {$major
> ++;}
> if($this->data['ArvcProfile']['inverted_t_waves'] == 1)
> {$minor++;
> $groups[]=3;}
> if($this->data['ArvcProfile']['epsilon_waves'] == 1)
> {$major++;}
> if($this->data['ArvcProfile']['late_potentials'] == 1)
> {$minor++;
> $groups[]=4;}
> if($this->data['ArvcProfile']['lbbb_vt'] == 1) {$minor++;
> $groups[]
> =5;}
> if($this->data['ArvcProfile']['familial_disease'] == 1)
> {$major++;}
> if($this->data['ArvcProfile']['familial_sd'] == 1) {$minor++;
> $groups
> []=6;}
> if($this->data['ArvcProfile']['familial_history'] == 1)
> {$minor++;
> $groups[]=6;}
>
> $this->data['ArvcProfile']['minor_criteria'] == $minor;
> $this->data['ArvcProfile']['major_criteria'] == $major;
>
> if ($major > 1 || ($major == 1 && $minor > 1) || ($minor >
> 3)) {
> $this->data['ArvcProfile']['criteria_fulfilled'] == 1;
> }
> return true;
> }
>
> /Anders
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---