Newer
Older
smart-home-server / server / SHServ / Helpers / MetaImplementation.php
<?php

namespace SHServ\Helpers;

use \SHServ\Helpers\MetaWrap;

trait MetaImplementation {
	protected $meta_wrap_instance;

	abstract public function id(): Int;
	abstract public function get_table_name(): String;

	public function meta(): MetaWrap {
		if(!$this -> meta_wrap_instance) {
			$this -> meta_wrap_instance = new MetaWrap(
				$this -> get_table_name(), 
				$this -> id()
			);
		}

		return $this -> meta_wrap_instance;
	}
}