0

I have a problem: I have these tables in DB:

  • Users
  • Empresas (enterprises) ("hasMany users" and "hasMany documents")
  • Documents
  • And many other related to "Empresas"

And after cake bake all for "documents", the code generated for views (example Documents/view) is always the code for Users:

<div class="documentosDocs view">
<h2><?php  echo __('Documentos Doc'); ?></h2>
<dl>
    <dt><?php echo __('Id'); ?></dt>
    <dd>
        <?php echo h($user['User']['id']); ?>
        &nbsp;
    </dd>
    <dt><?php echo __('Empresa'); ?></dt>
    <dd>
        <?php echo $this->Html->link($user['Empresa']['id'], array('controller' => 'empresas', 'action' => 'view', $user['Empresa']['id'])); ?>
        &nbsp;
    </dd>
    <dt><?php echo __('Username'); ?></dt>
    <dd>
        <?php echo h($user['User']['username']); ?>
        &nbsp;
    </dd>
    <dt><?php echo __('Password'); ?></dt>
    <dd>
        <?php echo h($user['User']['password']); ?>
        &nbsp;
    </dd>
    <dt><?php echo __('NombreCompleto'); ?></dt>
    <dd>
        <?php echo h($user['User']['nombreCompleto']); ?>
        &nbsp;
    </dd>
    <dt><?php echo __('Email'); ?></dt>
    <dd>
        <?php echo h($user['User']['email']); ?>
        &nbsp;
    </dd>
    <dt><?php echo __('Role'); ?></dt>
    <dd>
        <?php echo h($user['User']['role']); ?>
        &nbsp;
    </dd>
    <dt><?php echo __('Group'); ?></dt>
    <dd>
        <?php echo $this->Html->link($user['Group']['name'], array('controller' => 'groups', 'action' => 'view', $user['Group']['id'])); ?>
        &nbsp;
    </dd>
    <dt><?php echo __('Created'); ?></dt>
    <dd>
        <?php echo h($user['User']['created']); ?>
        &nbsp;
    </dd>
    <dt><?php echo __('Modified'); ?></dt>
    <dd>
        <?php echo h($user['User']['modified']); ?>
        &nbsp;
    </dd>
</dl>
</div>
AD7six
  • 63,116
  • 12
  • 91
  • 123
Kanfor
  • 138
  • 6
  • Hola ;) No se si se puede hablar en otras idiomas aqui, asi que... I'll respond in English but let me know if you don't understand. What does `bake` put in your DocumentosController? And what's the structure of your database table? – SharkofMirkwood Jul 18 '13 at 12:19
  • Sounds like a bug rather than a question - please report it to [the bug tracker](https://cakephp.lighthouseapp.com/) including your schema as without it I doubt it can be reproduced. – AD7six Jul 18 '13 at 21:02
  • Ya conseguí que funcionara! No sé cómo, pero un buen al reiniciar al día siguiente funcionó. Mi problema era que al hacer el cake bake en la Consola con diferentes controladores, siempre me daba los campos del controlador User, aunque escogiera en la lista otros (por ejemplo "documentos"). Pero se solucionó. Gracias por las respuestas. – Kanfor Jul 20 '13 at 12:17

0 Answers0