cakephp 3 Insert with Query Builder update Timestamp fields

2015-12-22 Thread Willem
Using the query builder to insert multiple rows of data the timestamp 
fields are not automatically updated, is this correct? 

so i changed my code a little to add the fields myself. Not sure if this is 
the best way or am i missing something


$oQuery = $this->query();
>
> if (($handle = fopen($tmpFilename, "r")) !== FALSE) {
> while (($data = fgetcsv($handle, 0, ",")) !== FALSE) {
> $num = count($data);
> if ($linenumber == 1) {
> for ($c = 0; $c < $num; $c++) {
> $columnnames[] = $data[$c];
> }
> } else {
> for ($c = 0; $c < $num; $c++) {
> $line['csv_file_id'] = $csvFileId;
> $line['linenumber'] = $linenumber;
> $line['columnname'] = $columnnames[$c];
> $line['columndata'] = $data[$c];
> $line['created'] = date('Y-m-d h:m:s');
> $line['modified'] = date('Y-m-d h:m:s');
>
> $oQuery->insert(['csv_file_id', 'linenumber', 'columnname', 
> 'columndata','created','modified'])
> ->values($line); 
> }
> }
> $linenumber++;
> }
> fclose($handle);
>
> $oQuery->execute();
>
>

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Access development server from another (local) computer

2015-12-22 Thread John Andersen
That question is not really related to CakePHP.

Depending on your setup, you will have to open the firewall on the 
computer, where you have your site running. You will probably also have to 
configure your webserver (apache, nginx, etc.) to accept connections from 
other IP addresses than localhost.

Tell what you have tried and how far you got :)
Enjoy, John

On Tuesday, 22 December 2015 12:39:13 UTC+2, Ken Hargy wrote:
>
> I'm new to CakePHP so maybe I'm missing something obvious... I set 
> everything up as expected and I ran:
>
> bin/cake server
>
> everything works fine if I go to http://localhost:8765, but I want to 
> access it on another computer on my local network. It seems like it's not 
> allowing connections other then localhost to port 8765.
>
> Is there a setting for that somewhere?
>

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: CakePHP 3 Shell arguments and options

2015-12-22 Thread euromark
See the existing core shells for details.
They use it quite a bit.

Tip: ConsoleOptionParser

Mark


Am Dienstag, 22. Dezember 2015 11:39:13 UTC+1 schrieb Martina Weinzettelova:
>
> Hello
>
> I cant find in docummentation how can i access passed argumet and options 
> in shell function.
>
> bin/cake myshell function --option value
>
> How can i read --option ???
>

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: How to unset field value of a post edit view

2015-12-22 Thread euromark
You need to be more specific.
Also, your forms should always preserve the correct state on post, and 
should preset on get with DB values etc.

Failing to do so will get you in trouble.
Mark


Am Dienstag, 22. Dezember 2015 11:39:13 UTC+1 schrieb Amit Gora:
>
> i am using checkbox array in my form and save their values "," separated 
> in database. so when i go into edit view of this post then it`s get default 
> value of field which is set by controller so i want to disable it for some 
> fields. how i can do it??
>

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: how to connect a simple registration form with mysql

2015-12-22 Thread euromark
Please see the tutorials in the docs.

Mark


Am Dienstag, 22. Dezember 2015 11:39:13 UTC+1 schrieb kumar pkvel:
>
> i want to connect a registration form am a beginner  i need to connect in 
> xampp cake php version3.1.2
>

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to delete first record using postLink()

2015-12-22 Thread euromark
You already answer yourself: Forms in forms is invalid.
The docs tell you what to do, use a block to capture the forms of the 
postLink() and output it after you closed the form.

Mark


Am Dienstag, 22. Dezember 2015 11:39:13 UTC+1 schrieb Jaspreet Sarao:
>
> Hello, I am new to cakephp..
>
> I have used postLink() to delete the records. On a page, I am unable to 
> delete first record using postLink(). I have used postLink() after 
> $this->Form->create.
>
> 
> $this->Form->postLink($image1, array(
> 'action' => 'delete',
> $item[$modelClass]['id'],
> ), array('escape' => false), __('Are you sure?'));
>
> 
>
> Can anybody help me?
>
>
>

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Cake php 3.0

2015-12-22 Thread Leandro Machado Pereira
Bruna, você pode incluir no seu router.php a configuração da rota padrão.

http://book.cakephp.org/3.0/en/development/routing.html#quick-tour

On Tue, Dec 22, 2015, 08:39   wrote:

> Boa tarde..estou usando o cake php 3.0,no meu localhost a aplicação ja
> esta pronta quando entro no navegador e
> digito:localhost/projeto/users/login aparece o login,so que la no meio do
> projeto o usuario digita no navegador::localhost/projeto/ aparece a pagina
> de inicial do cake alguem sabe como mudar isso,fazer um redirecionamento
> para algum controller..
>
> --
> 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 https://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Controller does not load automatically models in plugin (Cake 2.7.5)

2015-12-22 Thread Marco Garcia
The title already speaks exactly my problem. 

The controller does not load the standard model in the Plugin. I have to do 
manually. 

Including adding the word "Model " on the App::uses() , if not does not 
work.

e.g.: App::uses("ContactModel", "PluginName.Model")

If I insert just App::uses("Contact", "PluginName.Model"), not working.


Can someone help me?

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


how to select special fields in query in cakephp 3

2015-12-22 Thread Amir Shabani
Hi chums :]

I am very new on cakephp.  I've asked this question in stackoverflow 

 , 
but nobody could not help.
Well, I am here to help me.


I need to join 3 tables (movies, comments, users) in my cakephp 3 
controller and select only some special fields. I tested different 
solutions. I surfed a lot, but I could not solve it. Actually I need to 
show the last 3 comments on member profile.


Below is controller :

$movietbl = TableRegistry::get('Services.Movies');
$movies = $movietbl->find()
->contain([
'Comments' => function($q) {
return $q->autoFields(false)
->select([ 'id' , 'title' , 'comments']);
},
'Userscomments' => function($q) {
return $q->autoFields(false)
->select(['lname', 'fname', 'id']);
}])
->where(['Movies.user_id' => $this->getUserId()])
->limit(3);
$this->set('movies', $movies);
$this->set('userId', $this->getUserId());


below is MoviesTable

$this->belongsToMany('Userscomments', [
'className' => 'Services.Users',
'joinTable'=>'comments',
'foreignKey' => 'movie_id',
'targetForeignKey' => 'user_id',
]);
}


but it returns all of fields. What should I do now?

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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


CakePHP 3 Shell arguments and options

2015-12-22 Thread Martina Weinzettelova
Hello

I cant find in docummentation how can i access passed argumet and options 
in shell function.

bin/cake myshell function --option value

How can i read --option ???

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


How to unset field value of a post edit view

2015-12-22 Thread Amit Gora
i am using checkbox array in my form and save their values "," separated in 
database. so when i go into edit view of this post then it`s get default 
value of field which is set by controller so i want to disable it for some 
fields. how i can do it??

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Fetch views on the same page

2015-12-22 Thread Khoảng Lặng Sau Sân Khấu
Hello Everybody,

I have a problem with my final cakephp project. I'd like include some views 
on index page, but i don't know how include views on the same a page.
Please, comment your method, 
I'm looking forward hearing from you,
Thank you,
Phuong Danh,




-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Access development server from another (local) computer

2015-12-22 Thread Ken Hargy
I'm new to CakePHP so maybe I'm missing something obvious... I set 
everything up as expected and I ran:

bin/cake server

everything works fine if I go to http://localhost:8765, but I want to 
access it on another computer on my local network. It seems like it's not 
allowing connections other then localhost to port 8765.

Is there a setting for that somewhere?

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


how to connect a simple registration form with mysql

2015-12-22 Thread kumar pkvel
i want to connect a registration form am a beginner  i need to connect in 
xampp cake php version3.1.2

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Cake php 3.0

2015-12-22 Thread bruna
Boa tarde..estou usando o cake php 3.0,no meu localhost a aplicação ja esta 
pronta quando entro no navegador e digito:localhost/projeto/users/login 
aparece o login,so que la no meio do projeto o usuario digita no 
navegador::localhost/projeto/ aparece a pagina de inicial do cake alguem 
sabe como mudar isso,fazer um redirecionamento para algum controller..

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Unable to delete first record using postLink()

2015-12-22 Thread Jaspreet Sarao
Hello, I am new to cakephp..

I have used postLink() to delete the records. On a page, I am unable to 
delete first record using postLink(). I have used postLink() after 
$this->Form->create.


$this->Form->postLink($image1, array(
'action' => 'delete',
$item[$modelClass]['id'],
), array('escape' => false), __('Are you sure?'));



Can anybody help me?


-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


ROUTER for friendly URL

2015-12-22 Thread Marco Garcia
Redid a website for a client in Cake 2.X and the current site (made native 
in PHP) has a BD with friendly URLs, something like: 
city/typestore/name-of-shop. Obviously the HTACCESS is set to receive and 
treat URLs and "play" the content accordingly.

In the new application (in CakePHP) what I did was this: stores/show/123. 
Those who understand Cake know it's the controller/action/parameter. The 
123 is the ID that step as a parameter.

In the table of the site I have some columns as friendly Url and shop ID 
(in the example above would be 123)

How can I link these two information, ie, accessing the friendly URL I play 
ROUTE in the controller, action, and parameter (ID) correctly, pulling the 
BD (for ID only)?

NOTE 1: It is noteworthy that the new application does NOT have direct 
access to the database. It's all Web service/API. I have a method layout 
where I send the URL and it returns ID. Send ID return URL. I also have the 
programmer's API willingness to create what it takes to succeed.

NOTE 2: The call to the store have to be stores/show/SHOP_ID

Can someone help me?

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


I can't generating code coverage report in app/Test/Case/...

2015-12-22 Thread Hoa Vi Quang
I run command line:
E:\xampp\htdocs\xxx\app>"./Console/"cake test app Model/BaseModel --stderr 
--coverage-html=coverage
or
E:\xampp\htdocs\xxx\app>"./Console/"cake test app All --stderr 
--coverage-html=coverage

but when view https://xxx/app/webroot/coverage/app_Test_Case.html i do not 
see it.
Please help me! 
Thank you so much!

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: CakePHP plugin with static pages (PagesController in Plugin)

2015-12-22 Thread Fabricio Camarano
I know this is quite old, but I'm facing the same issue and google results 
brought me here.. 
So, which one could you say is the most suitable solution?.. the most 
conventional as you pointed or A?

El sábado, 16 de marzo de 2013, 14:53:53 (UTC-3), Vanja Dizdarević escribió:
>
> See the title of the post? I went nearly mad searching for it!! So I made 
> it SEO friendly for any brothers-in-pain...
>
> Question: What is the "proper" way to serve static pages in a plugin?
>
> My basic idea was: "Oh, I'll just create the file in 
> *'app/Plugin/ContactManager/Views/Pages/introduction.ctp'* and it should 
> pop up in */contact_manager/pages/introduction or **/pages/*
> *contact_manager/**introduction*"
>
> Got: 
> Error: MyFancyBoxerShorts.PagesController could not be found.
> Error: Create the class PagesController below in file: .
>
> But I don't feel like creating a duplicate class name
>
> I even tried
> //file: PluginName/Controller/PagesController.php
> require_once(ROOT . DS . APP_DIR . DS . 'Controller' . DS . 
> 'PagesController.php');
>
> But this fails, because the magic of Pages routing doesn't apply for 
> plugins.
>
> So, I have 2 possible solutions:
>
> *A: Create a PagesController inside my Plugin*
> - CON: duplicates class name
> - CON: Any PagesController overrides from the user's app are lost (like 
> layouts, helpers, markup parsers, tweaks)
> - CON: requires plugin routing to achieve default pages/* (action: 
> display) functionality
>
> *B: Add the pages routing to plugin routes.php (more conventional)*
> Create PluginName/PagesController.php // require_once(ROOT . DS . APP_DIR 
> . DS . 'Controller' . DS . 'PagesController.php');
> Add ONE of these in the routes.php
> Router::connect('/:plugin/pages/*', array('controller' => 'pages', 
> 'action' => 'display')); // potentially unsafe if other plugins define the 
> same
> Router::connect('/contact_manager/pages/*', array('controller' => 'pages', 
> 'action' => 'display', 'plugin' => 'ContactManager')); //the "suitable 
> solution"
> Require the user to load routes with the Plugin.
>
>
> While writing this, I have found the "suitable solution" (again), but I 
> will leave it here in case anyone ever searches for it.
>
> And I would honestly like your input on the *most conventional* way of 
> doing this seemingly default-ish routing behavior.
>
>
>

-- 
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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


What is the best way to fin and use a template in cakephp 3

2015-12-22 Thread Romuald Franck
Hi to everyone, i'm new in cakephp and I have started with version 3. I 
want to build a beautifull app and because I'm not good in design, I would 
really like to use a free template or buy one that I can use within cakephp.

So, I would really appreciate all your proposition and ideas or best 
practise. The easy way will be the best because I don't have a lot of time 
with this project. Thank you 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 https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.