What does $this->get('test') return? Is it an entity?

On Thursday, July 31, 2014 3:47:47 AM UTC+2, Tiago Barrionuevo wrote:
>
> Hi,
>
> I'm trying to build a form, with a CakePHP 3 application, using view 
> blocks but I can't get it to work. It seens that the Form->create() doesn't 
> find the model.
> I build a simple form to test it (controller Tests): 
>
>
> src/Template/Tests/view_block.ctp
>
> <?php
> $this->set('cadastro_title', $this->get('search_modulename') . ' - 
> VIEW_BLOCK');
> $this->set('cadastro_entity', $this->get('test'));
>
> $this->extend('/Common/cadastro_editor');
>
> $this->start('cadastro_data');
> ?>
>
> <fieldset>
>   <div class="row">
>     <?= $this->Form->input('id', array('label' => 'Id:' ));?>
>   </div>
>
>   <div class="row">
>     <?= $this->Form->input('name', array('label' => 'Name:' ));?>
>   </div>
>
>   <div class="row">
>     <?= $this->Form->input('result', array('label' => 'Result:' ));?>
>   </div>
> </fieldset>
>
> <?php $this->end(); ?>
>
> ---------------------------------------------------------------------------
> src/Template/Common/cadastro_editor.ctp
>
> <div> 
>   <h2><?php echo $this->get('cadastro_title'); ?></h2> 
>  
>   <div class="container"> 
>     <?php 
>         echo $this->Form->create($this->get('test') ); 
>         //echo $this->Form->create($this->get('cadastro_entity') ); 
>  
>         echo $this->fetch('cadastro_data'); 
>  
>       echo $this->Form->end(); 
>     ?> 
>   </div> 
> </div>
>  
> ======================================
> The same form without view block works ok:
>
> <?php
> $this->set('cadastro_title', $this->get('search_modulename') . ' - VIEW');
> ?>
> <div>
>   <h2><?php echo $this->get('cadastro_title'); ?></h2>
>
>   <div class="container">
>     <?php
>       echo $this->Form->create($this->get('test') );
>     ?>
>
>     <fieldset>
>       <div class="row">
>         <?= $this->Form->input('id', array('type'=>'text', 'label' => 
> 'Id:' ));?>
>       </div>
>
>       <div class="row">
>         <?= $this->Form->input('name', array('label' => 'Name:' ));?>
>       </div>
>
>       <div class="row">
>         <?= $this->Form->input('result', array('label' => 'Result:' )); ?>
>       </div>
>     </fieldset>
>   </div>
> </div>
>
>
> Maybe I'm doing something wrong!
>
> Thanks in advance
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to