Class myDbDateCompareValidator

Description

Class for compare two dates , one from a form and other from a database, and verify if them follows the condition passed

  • author: Diego Cebrián

Located in /apps/frontend/lib/myDbDateCompareValidator.php (line 10)

sfValidator
   |
   --myDbDateCompareValidator
Method Summary
boolean execute (string &$value, string &$error)
boolean initialize (unknown_type $context, [array $parameters = null])
Methods
execute (line 98)

Function that execute the validation with the parameters passed in initialize, except the value, that is passed here by the validation helper, and it's value is the value filled in the field form to check

  • access: public
boolean execute (string &$value, string &$error)
  • string &$value
  • string &$error
initialize (line 76)

Function to start the validation class.

The parameters array is composed of (+ are mandatory, * one of this is mandatory):

  • +class_name: The class where the date is stored
  • +date_db: the date column name to compare in the db table
  • +date_php: the date to compare name in php class
  • +found_error: the error message to return to the user
  • +search_type: This is the condition to return false. The posible values for search_type (without colomns):
    • 'NOT_EQUAL'
    • 'GREATER_THAN'
    • 'LESS_THAN'
    • 'GREATER_EQUAL'
    • 'LESS_EQUAL'
    • Empty value is Equal
  • -exception_id: if there is an exception row in the table (Example: in edition the row edited), it takes the field of the form which contains it)
  • -criteria: some additional criteria for propel selection. This aditional criteria must be noted this way:
    • criteria:
      • criteria1:
        • +column: column name for criteria checking
        • *value: value for criteria
        • *field: field of the form where the value is defined
        • -criteria: criteria pattern (see symfony or propel documentation)

The date passed by $value is searched in the table 'class_name'.

The table must have a colum called 'column_filter', and the validator only will compare with the fields that have in this column 'column_value'.

To get the true answer (and can execute without error) there must not be any field of the column * 'column' that can be find using the search_type.

  • access: public
boolean initialize (unknown_type $context, [array $parameters = null])
  • unknown_type $context
  • array $parameters

Documentation generated on Sun, 22 Mar 2009 19:18:08 +0100 by phpDocumentor 1.4.2