Skip to content

Creating a preSave hook inside component, won't use the custom cast of the property #273

@rodriciru

Description

@rodriciru
	property
		name  ="activoSN"
		column="Activo"
		type  ="boolean"
		casts ="casts.BooleanSNCast";
	property
		name  ="active"  
		column="Active"
		type  ="boolean"
		casts ="BooleanCast@quick";

Creating a preSave hook inside component, won't use the custom cast of the property:

function preSave(){
	this.assignAttribute( "activoSN", this.getActive()); //-> This will set activoSN to 1 or 0, but the cast its made to be 'S' or 'N' according of the boolean 
}

Setting like this, will make it right:

usuario.fill( {
		"activoSN" : true //This will be 'S' on the DB
	} );
usuario.save();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions