/**
  * Create a new Table instance 
  *
  * This method should not be used outside the framework. To retrieve/create a
  * Table instance, use Table::Get($className) instead.
  * 
  * @param string $className [description]
  */
 public function __construct($className)
 {
     // Get class reflection info
     $this->class = new \ReflectionClass($className);
     $this->className = ArrayUtil::LastItem(explode('\\', $this->class->getName()));
     // Get DB connection
     $this->initConnection();
     // Check table info
     $this->initTableName();
     $this->getTableInfo();
     // Activate callbacks
     $this->callbacks = new Callbacks($this->class);
     // Check if we record timestamps
     if (($recordTimestamps = $this->class->getStaticPropertyValue("recordTimestamps", null)) && $recordTimestamps == true) {
         // Register callbacks
         $this->callbacks->Register("beforeCreate", "recordTimestampsCreate");
         $this->callbacks->Register("beforeSave", "recordTimestampsModify");
     }
 }
 /**
  * Use an abstract location to find an actual file
  * @param string $file Abstract filename, as used in views, layout, etc. E.g.: "views/news/index", or "layout/main", or "views/news/index.txt"
  * @param boolean &$php If you pass a variable, this will be set to true, when the extension is a PHP extension, and should be parsed.
  * @return string The file location, or false when not found
  */
 private function lookForFile($file, &$php = null)
 {
     //TODO: The Request should have a FORMAT that it requests, based on the extension in the URL or the HTTP-accept header. This should be linked to an extension of a file to look for (.html, .txt, .json, etc.)
     // Split up in parts on /
     $dirparts = explode("/", $file);
     // Check filename for extensions
     $filename = array_pop($dirparts);
     // Loop through the request format's extensions
     $extensions = $this->request->format->extensions;
     foreach ($extensions as $extension) {
         // No extension at all?
         $fileparts = explode(".", $filename);
         if (count($fileparts) == 1) {
             // Add format's extensions
             array_push($fileparts, $extension);
         }
         // Look for file now
         $completeFilename = APPLICATION_DIR . implode($dirparts, "/") . "/" . implode($fileparts, ".");
         if (file_exists($completeFilename)) {
             // PHP?
             $php = ArrayUtil::LastItem($fileparts) == ChickenWire::get("phpExtension");
             // Found it!
             return $completeFilename;
         }
         // Should we look for the PHP variant?
         if (ArrayUtil::LastItem($fileparts) != ChickenWire::get("phpExtension")) {
             // Add php too
             array_push($fileparts, ChickenWire::get("phpExtension"));
             $completeFilename = APPLICATION_DIR . implode($dirparts, "/") . "/" . implode($fileparts, ".");
             if (file_exists($completeFilename)) {
                 // PHP!
                 $php = true;
                 // Found it!
                 return $completeFilename;
             }
         }
     }
     // Nothing :(
     return false;
 }