/**
  * Create a new instance of dbpersitable which does column mapping for each record.
  * @param array|\Traversable $records something that is
  */
 public function populate($records)
 {
     $this->inputRecords = $records;
     foreach ($records as $record) {
         $persist = new DBPersistable($this->connection, $this->database, $this->table);
         $persist->populate($record);
         $persist->setDateFields();
         $this->append($persist->getRecord());
     }
 }
Ejemplo n.º 2
0
 public function attachDateAddedFields(BaseModel $Model, DBPersistable $Persistable)
 {
     if ($Persistable->hasDateAddedField()) {
         $column = $this->lookupModelColumn($Model, "dateAdded");
         if ($column) {
             $Model->dateAdded = $Persistable->DateAdded;
         }
         $column = $this->lookupModelColumn($Model, "dateTimeAdded");
         if ($column) {
             $Model->dateTimeAdded = $Persistable->DateTimeAdded;
         }
     }
 }