<?php

namespace App\QuickReports\PivotTables;

/**
 * Manages configurations for pivot table content population.
 * @author Gabi
 */
class Configs extends \App\EntityPreference\BaseAbstract
{

	/**
	 * The name of the entity identifier field in the database table.
	 * @var String
	 */
	protected $field_idEntityName='pivotSource';

	/**
	 * This constant indicates if the database table stores the last update user.
	 * Set to false/blank/null if the field is not available for a certain class.
	 * @var String
	 */
	protected $field_lastUpdateUser = null;

	/**
	 * This indicates if the database table stores the last update time.
	 * Set to false/blank/null if the field is not available for a certain class.
	 * @var String
	 */
	protected $field_lastUpdateTime = null;

	/**
	 * (non-PHPdoc)
	 * @see \App\EntityPreference\BaseAbstract::setDbTableName()
	 */
	protected function setDbTableName()
	{
		global $DBTPivotTablesConfigs;
		$this->DBTEntityPreferences = $DBTPivotTablesConfigs;
	}

	/**
	 * Sets the id of the entity;
	 * @param Int $id
	 * @throws \Exception
	 */
	protected function setEntityId($id)
	{
		// check input
		if (!strlen($id)) throw new \Exception('Pivot table source is not valid');
		$this->id = $id;
	}
}