예제 #1
0
 /**
  * {@inheritdoc}
  *
  * @param string $string    The filename or string of valid CSV to parse.
  * @param bool   $fromFile  Set true to parse the string directly.
  * @param string $delimiter The character or sequence that delimits fields.
  *
  * @uses SimpleDbTable::data Stores the loaded data to the data property.
  */
 public function setData($string, $fromFile = false, $delimiter = ',')
 {
     $data = Parse::csv($string, !$fromFile, false, $delimiter);
     if ($this->validate($data)) {
         $this->data = $data;
     }
 }
예제 #2
0
 /**
  * Loads the table from a valid JSON string or file.
  *
  * @param string $json     The filename or string of valid JSON to parse.
  * @param bool   $fromFile Set to true to indicate that $json is a file.
  *
  * @uses SimpleDbTable::data Stores the loaded data to the data property.
  */
 public function setData($json, $fromFile = false)
 {
     $data = Parse::json($json, !$fromFile);
     if ($this->validate($data)) {
         $this->data = $data;
     }
 }