Re: CakePHP 3: How to Bake template from vendor/authorname/pluginname?

2015-04-07 Thread Salines
Resolved, I forgot to load plugin in the bootstrap.

-- 
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.


CakePHP 3: How to Bake template from vendor/authorname/pluginname?

2015-04-07 Thread Salines


If you want to create a package / plugin in vendor folder, which will be 
used for development eg Admin plugin, how do you set up the structure of 
the folders and where you will put the template files?

I try the following:

myapp/
  vendor/
salines/
  admintheme/
src/
  Template/
Bake/
 Layout/
 Template/
 ... etc

I added in the vendor/cakephp-plugins.php

'AdminTheme' => $baseDir . '/vendor/salines/admintheme/'

When I type in the console:

cake bake template Admin.users -t AdminTheme

I get an error message: AdminTheme is not valid value for --theme

in the console are shown, possible options Bake, Migrations, therefore this 
my plugin is not shown.

Please help, what do I need to do, in order to have a functional plugin, 
after which I want to share with you.

thank You

http://stackoverflow.com/questions/29502877/cakephp-3-how-to-bake-template-from-vendor-authorname-pluginname

-- 
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.


Mock auth component in controller test using testAction

2015-04-07 Thread Sebastian Bergquist


Hi! I’m having some problems with my tests. I can’t seem to mock the auth 
component in a controller test using the testAction method… Here are the 
part of the test that causes the problem: 
https://gist.github.com/beez/6f9ee89538d1a6be6dfb Any help or pointers on 
how to solve this is greatly appreciated!

-- 
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.


Re: Still having trouble with saving BelongsToMany data

2015-04-07 Thread José Lorenzo
I think you should better jump into the IRC channel so we can debug step by 
step your code. Using google groups for debugging problems has proven to be 
difficult. 

On Monday, April 6, 2015 at 10:22:41 PM UTC+2, Mauri Cabrera wrote:
>
> This is my add function and its add.ctp form Im following the google group 
> and this repository so you know how my other baked entities tables 
> controllers are
>
> public function add()
> {
> $sobre = $this->Sobres->newEntity();
> if ($this->request->is('post')) {
> // Reset indexes on the associated data 
>
> $this->request->data['products'] = 
> array_values($this->request->data['products']);
>
> $sobre = $this->Sobres->patchEntity($sobre, $this->request->data,
> ['associated' => 
> ['Products._joinData']]);
> //  $sobre = $this->Sobres->patchEntity($sobre, 
> $this->request->data,['associated'=>['products._joinData']]);
> //$sobre->dirty('products._joinData',true);
> if ($this->Sobres->save($sobre)) {
> $this->Flash->success('The sobre has been saved.');
> //return $this->redirect(['action' => 'index']);
> } else {
> $this->Flash->error('The listing could not be saved. Please, 
> try again.');
> }
> }
> $users = $this->Sobres->Users->find('list');
> $clients = $this->Sobres->Clients->find('list');
> $products = $this->Sobres->Products->find('list');
> $this->set(compact('sobre', 'users', 'clients', 'products'));
> $this->set('_serialize', ['sobre']);
> }
>
> 
> Form->create($sobre); ?>
> 
> 
> 
>
>  echo $this->Form->input('user_id', ['options' => $users]);
> echo $this->Form->input('client_id', ['options' => $clients]);
> echo $this->Form->input('total');
>
> if(!empty($products)){
> $i =0;
> foreach( $products as $k => $pro){
> echo 
> $this->Form->input('products.'.$i.'.id',['type'=>'checkbox','value'=>$k,'label'=>$pro]);
>  
> echo 
> $this->Form->input('products.'.$i.'._joinData.quantity'); 
> //  echo 
> $this->Form->input('products.'.$i.'.name',['type'=>'hidden','value'=>$pro]);
> //echo 
> $this->Form->input('products.'.$i.'.price',['type'=>'hidden','value'=>$pro]);
> $i++;
> }
> }
>
>
> ?>
> 
> Form->button(__('Submit')) ?>
> Form->end() ?>
> 
>
> PLEASE HELP!!!
>

-- 
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.


Re: Gerar CSV dos dados contidos no DB com cakephp

2015-04-07 Thread Keldnner Bader
Teste a action antes de passar ela para o javascript, tente acessar a url
que seria enviada para o ajax com um valor manual.
Quando você obter um resultado direto pela url, ai você parte para o js
fazendo testes do botão primeiramente vendo se ele retorna um simples alert
e quando for debugar o retorno do ajax, veja se a url é a mesma que você
usou no acesso direto.

2015-04-06 15:02 GMT-03:00 michel martins :

> Olá pessoal, tudo blz?
>
> Bom, há pouco tempo comecei a trabalhar com cakephp e estou com uma dúvida
> ao gerar dados para exportação em uma tabela CSV para excel.
>
> Criei as view e controllers, e estou utilizando a classe 
> https://github.com/FriendsOfCake/cakephp-csvview
> . 
>
> Mas, quando clico, não acontece nada. O que pode estar errado no processo?
>
> //função ajax para capturar o click, jogar no método PHP e retornar o link
> da planilha para download.
> $(function(){
>  $("#botoes button").click(function(){
> var botao = $(this).attr('data-download');
>  $.ajax({
> url:webroot('leads/Leads/export'),
> type:'post',
> data:{
> tipo: botao
> },
> success:function(r){
> $("#botoes button [data-download="+botao+"]").removeClass('btn-danger');
> $("#botoes button [data-download="+botao+"]").addClass('btn-success');
> $("#botoes button [data-download="+botao+"]").val('Download');
>  },error:function(){
> console.log('erro');
> }
>  });
>
> });
>
> });
>
> No método:
>
> public function export(){
> $dados = $this->param('tipo');
>
> $this->loadModel('CadastroMailing');
> $conditions = array('OR'=>array('cadastro_mailing_tipo_id'=>$dados));
> $result = $this->CadastroMailing->find('all',array(
> 'conditions'=>$conditions , 'order'=>array('nome ASC')));
>  $_serialize = 'result';
>
> $this->viewClass = 'CsvView.Csv';
>  $this->set(compact('data', '_serialize'));
>  }
>
> Gostaria que o download iniciasse automaticamente após o clique, mas caso
> tenha que clicar no botão também resolve meu problema.
>
> Podem me ajudar?
>
> --
> 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.
>



-- 
Att,
*Keldnner Bader*
(41) 9848-0746

-- 
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.