Hi all
I have a persistent cfc with a custom getter function for the ACTIVE property, that looks like this:
component
entityname = “Accreditation”
extends = “ORMBaseAccreditation”
persistent = “true”
table = “T_ACCREDITATION”
readonly = “false”
cachename = “userCache”
cacheuse = “transactional”
output = “false”
{
property name=“ACCR_KY” column=“ACCR_KY” type=“numeric” ormtype=“integer” fieldtype=“id” generator=“sequence” params=“{sequence=‘T_ACCREDITATION_SEQ’}”;
property name=“TERMS_ACCEPTED_BO” column=“TERMS_ACCEPTED_BO” type=“string” ormtype=“char”;
property name=“T_PERSON” fieldtype=“many-to-one” cfc=“Person” fkcolumn=“PERS_KY” lazy=“true” missingRowIgnored=“true”;
property name=“T_ACCRE_WKF” fieldtype=“one-to-many” cfc=“AccreditationActivity” fkcolumn=“ACCR_KY” lazy=“true” inverse=“true” orderby=“ACCR_KY DESC”;
property name=“ACTIVE” persistent=“false” setter=“false”;
boolean function getActive(){
var isActive = false;
var notValidStatuses = “ACCEPTED,REFUSED,REVOKED”;
var endDate = this.attr(‘ACCREDITATION_END_DT’);
var status = this.attr(‘STATUS_DOMA_KY’);
if( (isNull(endDate) || (!isNull(endDate) && dateDiff(“d”, now(), this.attr(‘ACCREDITATION_END_DT’)) >= 0) ) && !isNull(status) ) {
return !listFind(notValidStatuses, status.attr(‘CODE_CD’));
}
return false;
}
}
I want to retrieve all ACCREDITATIONS for a person that are active. Retrieving by person works fine, but I can’t get the active ones.
Like this;
arrActiveAccreditations = entityLoad(“Accreditation”, {t_person = this, active = true});
I get this:
“Property ACTIVE not present in the entity”
And like this:
arrActiveAccreditations = ORMExecuteQuery(
“SELECT accr.ACCR_KY FROM Accreditation as accr WHERE accr.T_PERSON.PERS_KY=:persKy AND accr.ACTIVE=:bactive”
, { persKy=this.getpers_ky(), bactive=true } //
);
I get this:
“could not resolve property: ACTIVE of: Accreditation”
Can anyone see where I’m going wrong?