Select data from other models on Form

Hey Guys. I am working on a form for adding an museum object on database. I have a field where I should select the object donator, wich belongs to another table. The way I did it, I can already select the donators by name on the form, but then this happens:

Well, I want / need to remove these numbers from my select view, but can´t figure out how I do that.

Here is my controller function add code:

  public function add()

    $connection = ConnectionManager::get('default');
    $objeto = $this->Objeto->newEntity();
    if ($this->request->is('post')) {
        $objeto = $this->Objeto->patchEntity($objeto, $this->request->data);
        if ($this->Objeto->save($objeto)) {
            $this->Flash->success(__('The objeto has been saved.'));

            return $this->redirect(['action' => 'index']);
        $this->Flash->error(__('The objeto could not be saved. Please, try again.'));
    $this->set('_serialize', ['objeto']);

    $listaDoadores = $this->Doador->find('all', array(
    'fields' => array('Doador.nome')));

    $doadores = $connection->execute($listaDoadores)->fetchAll('assoc');

    if ($this->request->is('requested')) {   //Se for requisição de outra view/element:
        return $doadores;
    } else {  //Senão envia para a view padrão
        $this->set('doadores', $doadores);
    } ?>



And this is my View so far:

<?= $this->Form->create($objeto) ?>
    <legend><?= __('Add Objeto') ?></legend>
        echo $this->Form->input('nome');
        echo $this->Form->input('nomeTecnico');
        echo $this->Form->input('tipo');
        echo $this->Form->input('aquisicao');
        echo $this->Form->input('procedencia');
        echo $this->Form->input('dataDoacao', ['empty' => true]);
        echo $this->Form->input('dataObjeto');
        echo $this->Form->input('forma');
        echo $this->Form->input('cor');
        echo $this->Form->textarea('detalhamento', ['placeholder' => 'Detalhamento do Objeto']);
        echo $this->Form->input('dimensao_iddimensao');
        echo $this->Form->input('foto_idfoto');
        echo $this->Form->input('inscricao_idinscricao');

        echo $this->Form->input('doador_id', ['type' => 'select', 'options' => $doadores]);
        echo $this->Form->input('fabricante');
        echo $this->Form->input('historico');
        echo $this->Form->textarea('etiqueta_exposicao', ['placeholder' => 'Descrição da etiqueta de Exposição']);
        echo $this->Form->input('emExposição');
        echo $this->Form->input('condicao',['type' => 'select', 'options' => ['nome1' => 'Perfeito Estado', 'nome2' => 'Necessita Intervenção']]);
        echo $this->Form->input('condicao');
        echo $this->Form->input('catalogador');
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>

Can Anyone Help me see realize what am I doing wrong?
Thanks very much in advance!

In a cake 2.8 app I do same like this.

in the controller

 $proofs = $this->UserActivity->Proof->find('list', array('conditions'=>array($jointext),'order' => 'plist ASC'));

and in the view in the form

           echo $this->Form->input('proof_id', array(
				 'class' 	=> 'input select',
				 'label'   	=> 'Lernnachweis',
				 'type'    	=> 'select',
				 'empty'   	=> true,
				 'style'	=> 'width:130px;'

Perhaps its a new point of view.


@marc Replace this sort of codes

$listaDoadores = $this->Doador->find('all', array(
'fields' => array('Doador.nome')));


    $listaDoadores = $this->Doador->find('list',
            'keyField' => 'id',
            'valueField' => 'nome'

And try again!

I tried this, but it returns the same I had before plus the donator ID. =/

Tried to adapt your solution here, but I´m having some trouble with the $jointext variable. What would it be?

$jointext ist only a embarrassing expression of my stupidity :slight_smile:

		$jointext = '';
		if ($useractivity['User']){
			$user = $this->UserActivity->User->findById($useractivity['User']['id']);
			$nr = 0;
			foreach($user['Subject'] as $subs){
				$nr += 1;			
				if($nr > 1){				
					$jointext = $jointext . ' OR';			
				$jointext = $jointext . ' subject_id = ' . $subs['id'];

thats all.

Thanks for your help, I had several days trying to make this work