<?php

namespace App\Form\Input;

/**
 * Corporate trusts autocomplete field.
 * @author Gabriel
 */
class Autocomplete_CorporateTrust extends Autocomplete_GeneralAbstract
{
	protected $class = "autocompleteTrust";

	/**
	 * (non-PHPdoc)
	 * @see \Engine\Form\Input\Autocomplete::getUrl()
	 */
	public function getUrl()
	{
		return ($this->url?:\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/RemoteData/AutocompleteFieldData', '', ['class'=>'Trust', 'type'=>'corporate']));
	}

	/**
	 * (non-PHPdoc)
	 * @see \Engine\Form\Input\Autocomplete::determineDisplayValue()
	 */
	public function determineDisplayValue($displayId) :string
	{
		return (string)\Entity\Trust::select($displayId)->name;
	}

}
