Esempio n. 1
0
 public function __construct(array $attributes = array())
 {
     if (isset($attributes['table_name'])) {
         static::$lastTableName = $attributes['table_name'];
         $this->setTable(static::$lastTableName);
         unset($attributes['table_name']);
     } elseif (static::$lastTableName) {
         $this->setTable(static::$lastTableName);
     }
     // Configure date fields to output /
     $table_name = $this->getTable();
     $this->schema = Schema\Cache::get($table_name);
     if ($this->schema && isset($this->schema['attributes'])) {
         foreach ($this->schema['attributes'] as $attribute) {
             if (isset($attribute['type']) && $attribute['type'] == 'timestamp') {
                 array_push($this->dates, $attribute['name']);
             }
         }
     }
     parent::__construct($attributes);
     static::loadObserver($table_name);
 }