achingbrain/bbq — Issue #13: bbq.domain.Repository._createEntity
Author: alanshaw
Created: 2012-03-06 18:08:15+00:00
State: open

I'm having trouble understanding the loop at the end of this method:

if(this._entities[i].equals(data))

If the stored entity at index "i" equals data then...

data = this.get(i);

Set data equal to the entity in the repository

data.processData(data.options.data);

Get the entity to process the data it already has...

So, basically it throws away the new version of the entity - in my case it uses the partially loaded entity over the JSON I pass to Repository.add.

Could you explain, or is this a bug?