#1 ✓resolved
Dan Schultz

Validations

Reported by Dan Schultz | January 15th, 2011 @ 02:23 AM | in 0.1.0

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()
    {
        
    }
}

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 »

Mesh is an open-source persistence framework for Adobe Flex. It is designed to make the persistence of your application's model easier. Mesh provides the mechanisms for defining the associations between your model's entities, tracking which objects need to be saved, and mapping your entities to backend services.

<p>
<strong>Wiki</strong>
The Mesh wiki is hosted on GitHub at <a href="https://github.com/danschultz/mesh/wiki">https://github.com/danschultz/mesh/wiki</a>.
</p>

<p>
<strong>Source Code</strong>
Mesh is hosted on GitHub at <a href="http://github.com/danschultz/mesh">http://github.com/danschultz/mesh</a>.
</p>

Shared Ticket Bins

People watching this ticket

Referenced by

Pages