/includes/Database/Models/Object.php

  1. <?php if ( ! defined( 'ABSPATH' ) ) exit; 
  2.  
  3. /** 
  4. * Class NF_Database_Models_Object 
  5. */ 
  6. final class NF_Database_Models_Object extends NF_Abstracts_Model 
  7. protected $_type = 'object'; 
  8.  
  9. protected $_table_name = 'nf3_objects'; 
  10.  
  11. protected $_meta_table_name = 'nf3_object_meta'; 
  12.  
  13. protected $_columns = array( 
  14. 'type',  
  15. 'created_at' 
  16. ); 
  17.  
  18. public function __construct( $db, $id, $parent_id = '', $parent_type = '' ) 
  19. parent::__construct( $db, $id, $parent_id ); 
  20.  
  21. $this->_parent_type = $parent_type; 
  22.  
  23. public function save() 
  24. if( ! $this->_id ) { 
  25.  
  26. $data = array( 'created_at' => time() ); 
  27.  
  28. $result = $this->_db->insert( 
  29. $this->_table_name,  
  30. $data 
  31. ); 
  32.  
  33. $this->_id = $this->_db->insert_id; 
  34.  
  35. $this->_save_settings(); 
  36.  
  37. } // End NF_Database_Models_Object 
.