#1100 confirmed
Jordan Ritter

dm-validations causes lazy-loaded attributes to load one at a time

Reported by Jordan Ritter | October 21st, 2009 @ 11:31 AM

Simply including 'dm-validations' will add auto-validations for many standard property types. When the validations run, each validator operates on the property it applies to, and that property is loaded if not already (i.e. lazy).

The problem is that most standard property types get at least one auto-validation, so saving/updating objects with many/large lazy properties ends up defeating the value of lazy-loading to begin with, compounding the # of SQL queries for updating to 1 + # of lazy loaded properties.

Here is a demo & patch that "partially" solves the issue by loading all the attributes of fields-to-be-validated all in one shot, before the validators run. At the very least, it demonstrates the issue.

https://gist.github.com/5b7effb4cf5f737aa28e

After talking with dkubb, it might make more sense to just not fire the validators on attributes that aren't dirty/not-loaded, thereby reducing the overall CPU cost of saving/updating the models to begin with.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Pages