Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Validations

#1

Add support for validating entities before a save operation occurs. If an entity fails to validate, the save should fail.

Here's the approach to running validations:

  • By default, executing a save on an entity will run its validations.
  • Validations are executed through the beforeSave callback.
  • If the entity has any errors, it will cause its save operation to fault.
  • If any entity within a group of entities is invalid, it will cause the whole group to fail.

Defining Validations:

public class User extends Entity
{
    public static const validate:Object = {
        name: [{validator: Length, minimum: 0, message: "Name is too short"}],
        email: [{validator: Email}]
    }
    
    public function User()
    {
        
    }
}

Reported by Dan Schultz · January 15th, 2011 @ 02:23 AM

State: resolved
Milestone: 0.1.0
Assigned to: Dan Schultz Dan Schultz

Activity

  1. Dan Schultz
    Dan Schultz
    • Tag changed from validations to feature, validations

    January 15th, 2011 @ 02:44 AM

  2. Dan Schultz
    Dan Schultz
    • Milestone changed from 1.0.0 to 0.1.0

    January 16th, 2011 @ 07:18 PM

  3. Dan Schultz
    Dan Schultz
    • State changed from new to open

    January 17th, 2011 @ 12:33 AM

  4. Dan Schultz
    Dan Schultz
    • State changed from open to resolved

    January 18th, 2011 @ 03:27 AM

  5. Dan Schultz
    Dan Schultz
    • State changed from resolved to open

    January 18th, 2011 @ 07:40 PM

  6. Dan Schultz
  7. Dan Schultz
    Dan Schultz
    • State changed from resolved to open

    January 20th, 2011 @ 02:08 AM

  8. Dan Schultz
    Dan Schultz
    • State changed from open to resolved

    January 20th, 2011 @ 02:09 AM

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.