coldbox 3.1 - PopulateModel with arguments

Hi guys,

I’m using the ORMService within a Service and instead of populating a model with RC vars I need to populate with arguments.

I’ve tried this, but it doesn’t seem to work.

ORMService.populateModel(model=local.region,include=‘name,description,floor’,memento=arguments);
ORMService.save(local.region);

Am I doing this incorrectly?

Thanks.

Nolan

The function is just populate in the ORMService.

populate

public any populate(any target, struct memento, [string scope=’’], [boolean trustedSetter=‘false’], [string include=’’], [string exclude=’’], [boolean ignoreEmpty=‘false’])

Simple map to property population for entities

Parameters:

target

memento

scope - Use scope injection instead of setter injection, no need of setters, just tell us what scope to inject to

trustedSetter - Do not check if the setter exists, just call it, great for usage with onMissingMethod() and virtual properties

include - A list of keys to include in the population ONLY

exclude - A list of keys to exclude from the population

ignoreEmpty

Curt

What is the error?

I think I was mixing up populateModel() which I use in handlers and populate which is part of ORMService. Thanks Curt.

where does populateModel exist in the framework if it’s not part of the ORMService?

Thanks.

Nolan

It’s part of the Framework Supertype and can be used for populating any object, not just ORM objects.

Curt