protected function validateProperties($entity, $schema, $entityName)
    {
        $properties = get_object_vars($entity);

        if (!isset($schema->properties)) {
        	return $this;
            //throw new SchemaException(sprintf('No properties defined for [%s]', $entityName));
        }

        // Check defined properties
        foreach($schema->properties as $propertyName => $property) {
            if (array_key_exists($propertyName, $properties)) {
                // Check type
                $path = $entityName . '.' . $propertyName;
                $this->validateType($entity->{$propertyName}, $property, $path);
            } else {
                // Check required
                if (isset($property->required) && $property->required) {
                    throw new ValidationException(sprintf('Missing required property [%s] for [%s]', $propertyName, $entityName));
                }
            }
        }

        // Check additional properties
        if (isset($schema->additionalProperties) && !$schema->additionalProperties) {
            $extra = array_diff(array_keys((array)$entity), array_keys((array)$schema->properties));
            if (count($extra)) {
                throw new ValidationException(sprintf('Additional properties [%s] not allowed for property [%s]', implode(',', $extra), $entityName));
            }
        }

        return $this;
    }
protected function validateProperties($entity, $schema, $entityName)
    {
        $properties = get_object_vars($entity);

        if (!isset($schema->properties)) {
        	return $this;
            //throw new SchemaException(sprintf('No properties defined for [%s]', $entityName));
        }

        // Check defined properties
        foreach($schema->properties as $propertyName => $property) {
            if (array_key_exists($propertyName, $properties)) {
                // Check type
                $path = $entityName . '.' . $propertyName;
                $this->validateType($entity->{$propertyName}, $property, $path);
            } else {
                // Check required
                if (isset($property->required) && $property->required) {
                    throw new ValidationException(sprintf('Missing required property [%s] for [%s]', $propertyName, $entityName));
                }
            }
        }

        // Check additional properties
        if (isset($schema->additionalProperties) && !$schema->additionalProperties) {
            $extra = array_diff(array_keys((array)$entity), array_keys((array)$schema->properties));
            if (count($extra)) {
                throw new ValidationException(sprintf('Additional properties [%s] not allowed for property [%s]', implode(',', $extra), $entityName));
            }
        }

        return $this;
    }
protected function validateProperties ( $ entity , $ schema , $ entityName ) { $ properties = get_object_vars ( $ entity ) ; if ( ! isset ( $ schema -> properties ) ) { return $ this ; //throw new SchemaException(sprintf('No properties defined for [%s]', $entityName)); } // Check defined properties foreach ( $ schema -> properties as $ propertyName => $ property ) { if ( array_key_exists ( $ propertyName , $ properties ) ) { // Check type $ path = $ entityName . '.' . $ propertyName ; $ this -> validateType ( $ entity -> { $ propertyName } , $ property , $ path ) ; } else { // Check required if ( isset ( $ property -> required ) && $ property -> required ) { throw new ValidationException ( sprintf ( 'Missing required property [%s] for [%s]' , $ propertyName , $ entityName ) ) ; } } } // Check additional properties if ( isset ( $ schema -> additionalProperties ) && ! $ schema -> additionalProperties ) { $ extra = array_diff ( array_keys ( ( array ) $ entity ) , array_keys ( ( array ) $ schema -> properties ) ) ; if ( count ( $ extra ) ) { throw new ValidationException ( sprintf ( 'Additional properties [%s] not allowed for property [%s]' , implode ( ',' , $ extra ) , $ entityName ) ) ; } } return $ this ; }
Validate object properties

@param object $entity
@param object $schema
@param string $entityName

@return Validator
Validate object properties