Object.php 921 B

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