protected function configureMachine(array $config)
	{
		// Load simple config options
		$this->loadMachineConfig($config, ['table', 'table_alias', 'state_select', 'filters']);

		// Properties (unless set before)
		if ($this->properties === null) {
			if (empty($config['properties'])) {
				// Scan database for properties if not specified
				$this->scanTableColumns();
			}
		}

		// Setup machine. Properties may be set before initializing,
		// this will merge config with autodetected properties
		parent::configureMachine($config);

		// Collect primary key from properties
		if ($this->pk_columns === null) {
			$this->pk_columns = array();
			foreach ($this->properties as $property => $p) {
				if (!empty($p['is_pk'])) {
					$this->pk_columns[] = $property;
				}
			}
		}

		// Check for primary key
		if (empty($this->pk_columns)) {
			throw new InvalidArgumentException('Primary key is missing in table '.var_export($this->table, true));
		}

		// Prepare list of composed properties and encoded columns
		$this->composed_properties = array();
		$this->json_columns = array();
		foreach ($this->properties as $property => $p) {
			if (!empty($p['components'])) {
				$this->composed_properties[$property] = $p['components'];
			}
			if (isset($p['column_encoding']) && $p['column_encoding'] == 'json') {
				$this->json_columns[] = $property;
			}
		}
	}