Doctrine 1
  1. Doctrine 1
  2. DC-1049

error with Timestamp data Validation

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Validators
    • Labels:
      None
    • Environment:
      Linux

      Description

      The default value for timestamp is "0000-00-00 00:00:00", so
      $e = explode('T', trim($value))
      should be changed to
      $e = explode(' ', trim($value))

      public function validate($value)
      {
      if (is_null($value))

      { return true; }

      $e = explode('T', trim($value));
      $date = isset($e[0]) ? $e[0]:null;
      $time = isset($e[1]) ? $e[1]:null;

      $dateValidator = Doctrine_Validator::getValidator('date');
      $timeValidator = Doctrine_Validator::getValidator('time');

      if ( ! $dateValidator->validate($date))

      { return false; }

      if ( ! $timeValidator->validate($time)) { return false; }

      return true;
      }

        Activity

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Coiby Xu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: