Example #1
0
 /**
  * Returns normal set of metadata for the table that is set in the constructor
  *
  * @return array|bool|mixed
  */
 public function getMetadata()
 {
     // Try to get the model from the cache
     $cacheExists = !is_null($this->cache);
     $modelMetadata = $cacheExists ? $this->cache->getModelMetadata($this->tableName) : false;
     if (!$modelMetadata) {
         // Get the metadata and store it in the cache
         $modelMetadata = Database::getTableMetadata($this->tableName);
         if (count($modelMetadata) > 0 && $cacheExists) {
             $this->cache->setModelMetadata($this->tableName, $modelMetadata);
         } else {
             // @TODO report if needed
         }
     }
     return $modelMetadata;
 }