Re: [Cakephp 3.2.5] Cannot match provided foreignKey

2016-03-24 Thread Gaurav Kumar
Hello Manuel,

In your tables there is no PRIMARY KEY defined. So, your tables should look 
like this

CREATE TABLE `articles` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `user_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci 
AUTO_INCREMENT=1 ;

CREATE TABLE `users` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci 
AUTO_INCREMENT=1 ;

and then your issue will be resolve.

On Thursday, March 24, 2016 at 3:43:58 PM UTC+5:30, Manuel Maurer wrote:
>
> Hello,
>
> I am trying to upgrade some of my applications from Cake 2 to 3. To get 
> used to the new version I tried a few simple things and for some strange 
> reason I cannot get Associations to run...
>
> In my mysql database I have two simple tables:
>
> CREATE TABLE `articles` (
>   `id` bigint(20) UNSIGNED NOT NULL,
>   `title` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
>   `user_id` bigint(20) UNSIGNED NOT NULL
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
>
> CREATE TABLE `users` (
>   `id` bigint(20) UNSIGNED NOT NULL,
>   `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
>
> In a fresh copy of Cakephp 3.2.5 I added 3 files:
>
> *src/Model/Table/UsersTable.php:*
>
>  namespace App\Model\Table;
> use Cake\ORM\Table;
>
> class UsersTable extends Table
> {
> public function initialize(array $config){
> }
> }
>
>
> *src/Model/Table/ArticlesTable.php:*
>  namespace App\Model\Table;
> use Cake\ORM\Table;
>
> class ArticlesTable extends Table
> {
> public function initialize(array $config){
> $this->belongsTo('Users');
> }
> }
>
>
> *src/Controller/ArticlesController.php:*
>  namespace App\Controller;
>
> class ArticlesController extends AppController 
> {
> public function index(){
> $tmp = $this->Articles->find('all')->contain(['Users']);
> var_dump($tmp);
> exit;
> }
> }
>
> My development system is running MariaDB 10.0.15 and PHP 7.0.4 on W7.
>
> Finally I fire up http://test/articles and get this error:
> * Cannot match provided foreignKey for "Users", got "(user_id)" but 
> expected foreign key for "()" *
>
>
> The last item in the stack trace is this:
>
> Cake\ORM\Association\BelongsTo->_joinCondition 
> CORE\src\ORM\Association.php, line 557
>
>
> On the right hand side I get 
> cakephp-3-2-5\vendor\cakephp\cakephp\src\ORM\Association.php:
>
> 'finder' => $this->finder()
> ];
> 
> if (!empty($options['foreignKey'])) {
> $joinCondition = $this->_joinCondition($options);
> if ($joinCondition) {
> $options['conditions'][] = $joinCondition;
> }
> }
>
>
> And in the arguments table:
>
> [
>   'aliasPath' => 'Users',
>   'propertyPath' => 'user',
>   'includeFields' => true,
>   'foreignKey' => 'user_id',
>   'conditions' => [],
>   'fields' => [],
>   'type' => 'LEFT',
>   'table' => 'users',
>   'finder' => 'all'
> ]
>
>
> As a test I added a foreign key constraint to the database:
>
>
> ALTER 
> 
>  
> TABLE 
> 
>  
> `articles` ADD FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE 
> 
>  
> RESTRICT ON UPDATE 
> 
>  
> RESTRICT;
>
>
> However, that did not have any effects (not that I expected any).
>
> I also tried to specify the foreignKey, className etc. on the association, 
> no change there. I even downgraded to php 5.6 on my linux dev box, that 
> didn't help either.
>
>
> Any suggestions?
>
>
> Best regards,
>
> Manuel
>

-- 
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup

We will soon be closing this Google Group. But don't worry, we have something 
better coming. Stay tuned for an updated from the CakePHP Team soon.

Like Us on FaceBook https://www.facebook.com/CakePHP
Follow 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.
For more options, visit https://groups.google.com/d/optout.


Re: How to set a variable and use everywhere?

2016-03-19 Thread Gaurav Kumar
1. If you need to use that variable in controllers then you can set it in 
the beforeFilter and if you need to access the variable in views then 
beforeRender both you have to do in AppController.

2. Please follow this http://book.cakephp.org/3.0/en/views.html

On Thursday, March 17, 2016 at 10:26:13 AM UTC+5:30, Attachai Saorangtoi 
wrote:
>
> *1. How to set a variable and use everywhere?*
>  
> *2.How to send a variable to Layout and Element?*
>
>
>

-- 
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup

We will soon be closing this Google Group. But don't worry, we have something 
better coming. Stay tuned for an updated from the CakePHP Team soon.

Like Us on FaceBook https://www.facebook.com/CakePHP
Follow 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.
For more options, visit https://groups.google.com/d/optout.


Re: Srange behaviour with find('list')

2016-02-18 Thread Gaurav Kumar
Hello michael,

Check your displayField in the respective table file. If it is different 
from what you are trying to fetch then just add your field in the 
displayField just above the find query.

On Thursday, February 18, 2016 at 1:48:22 AM UTC+5:30, Michael Kornatzki 
wrote:
>
> Hi,
>
> i am using find('list') to get key/values and was very surprised that the 
> key-values are wrong!?
>
> if i use 
>   $corp = $SupplierCorps->find('list');
>   Log::debug($corp->toArray());
> i get
> [22] => 1003022
> [29] => 1003029
> ...
> where the key is the primaryKey defined in the Table-class and the value 
> is the displayField.
>
> This is ok but if  i use
>
> $corp = $SupplierCorps->find('list', ['keyField' => 'SupplCorp_No_auto']);
>
> i get this
> [1440065430] => 1003022
> [1440065437] => 1003029
>
> and this is wrong!
> The key should now the same as the value.
> And if i run the sql against the mysql-Database i get the right results
>
> Do i oversee something?
>
> I use cakePhp 3.1.5
>
> Thanks in advance,
> michael
>
>

-- 
We will soon be closing this Google Group. But don't worry, we have something 
better coming. Stay tuned for an updated from the CakePHP Team soon.

Like Us on FaceBook https://www.facebook.com/CakePHP
Follow 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.
For more options, visit https://groups.google.com/d/optout.


Re: Cakephp Login form with different database tables

2015-08-07 Thread Gaurav Kumar
Your distributors login submit looking for a 'distributor_login' method and 
that is missing 'DistributorsController'.

On Friday, July 31, 2015 at 4:54:16 PM UTC+5:30, Asmat Quadeer wrote:
>
> I am trying to create a login form for different types of users like
>
> `Suppliers`, `Distributors`, `Managers`
>
>
> on the website like
>
> http://azzip.de/distributors/login
>
> And the Distributor's beforeFilter looks like
>
> 
> public function beforeFilter() {
> 
> parent::beforeFilter();
> 
> AuthComponent::$sessionKey = 'Auth.Distributor';
> 
> $this->Auth->authenticate = array(
> 'Form' => array(
> 'userModel' => 'Distributor',
> 'fields' => array(
> 'username' => 'email',
> 'password' => 'password'
> ),
> 'scope' => array(
> 'Distributor.active' => 1,
> )
> )
> );
> 
> $this->Auth->allow('login', 'forgotpass', 'register');
> }
>
>
> The passwords are hashed. But no chance to login. and unfortunately also 
> can't see the the 
> `login()`
>
> query to debug. 
>
>

-- 
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: NewBie

2015-08-07 Thread Gaurav Kumar
$this refers the class in which you are currently working.

On Thursday, June 4, 2015 at 2:11:31 AM UTC+5:30, Kingston Abraham wrote:
>
> what is the difference between $this->request and $request->
>
> do both convey same information
>

-- 
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: Upgrade sage pay protocol v3 in cakephp 1.3

2015-06-23 Thread Gaurav Kumar
As per my knowledge you just need to change the version on request and the 
encryption method to AES-128-CBC-PKCS#5 and you are done. If every thing 
will be ok then you will get the response with some new additional data 
which are added in SagePay v3.0.

On Tuesday, June 23, 2015 at 2:21:56 PM UTC+5:30, Colin Rainsforth wrote:
>
> I need to update a site too - but from SagePay v2.2 to v3.0. 
>
> SagePay v2.2 seems to have had fewer madatory fields than v2.3. Can you 
> advise on this?
>
> Thanks in advance
>
> Colin
>
> On Friday, 19 June 2015 04:07:27 UTC+1, Gaurav Kumar wrote:
>>
>> I have used that in CakePHP 2.6, implemented sage pay for buy online. 
>> There is nothing that you have to change just changes the version and in 
>> the response you will get some additional data from sage pay so if you are 
>> saving them then you can check it.
>>
>> On Thursday, June 18, 2015 at 11:13:39 PM UTC+5:30, Eb ook wrote:
>>>
>>> Dear all,
>>>
>>> I'm using cakephp version 1.3 with.
>>>
>>> My website used sage pay for buy online. 
>>>
>>> The sagepay sent email for me. They suggested to upgrade protocol from 
>>> v2.23 to v3. 
>>>
>>> Can you help me upgrade it.
>>>
>>> Thanks regards.
>>>
>>

-- 
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: Upgrade sage pay protocol v3 in cakephp 1.3

2015-06-23 Thread Gaurav Kumar
Have you tried with the above solution? Because as per my knowledge you 
just need to change the version on request and the encryption method 
to AES-128-CBC-PKCS#5 and you are done. If every thing will be ok then you 
will get the response with some new additional date which are added in 
SagePay v3.0.

On Tuesday, June 23, 2015 at 2:21:56 PM UTC+5:30, Colin Rainsforth wrote:
>
> I need to update a site too - but from SagePay v2.2 to v3.0. 
>
> SagePay v2.2 seems to have had fewer madatory fields than v2.3. Can you 
> advise on this?
>
> Thanks in advance
>
> Colin
>
> On Friday, 19 June 2015 04:07:27 UTC+1, Gaurav Kumar wrote:
>>
>> I have used that in CakePHP 2.6, implemented sage pay for buy online. 
>> There is nothing that you have to change just changes the version and in 
>> the response you will get some additional data from sage pay so if you are 
>> saving them then you can check it.
>>
>> On Thursday, June 18, 2015 at 11:13:39 PM UTC+5:30, Eb ook wrote:
>>>
>>> Dear all,
>>>
>>> I'm using cakephp version 1.3 with.
>>>
>>> My website used sage pay for buy online. 
>>>
>>> The sagepay sent email for me. They suggested to upgrade protocol from 
>>> v2.23 to v3. 
>>>
>>> Can you help me upgrade it.
>>>
>>> Thanks regards.
>>>
>>

-- 
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: Date format

2015-06-21 Thread Gaurav Kumar
Try with this:
 echo $this->Form->input(
'birthdate',
array (
'label'=> false,
'dateFormat' => 'DD-MM-',
'minYear' => date('Y') - 100, 
'maxYear' => date('Y') - 12
)
);

On Saturday, June 20, 2015 at 4:24:15 AM UTC+5:30, Paulo Terra wrote:
>
> Hi,
>
> I have been trying to change the date format from -MM-DD to DD-MM- 
> on a form at my site, but although I have changed the intl.default_locale 
> to pt_BR as it says on CakePHP 3.0 documentation is still the same format.
>
> This is the view (add.ctp):
>
> echo $this->Form->input(
> 'birthdate',
> array (
> 'label'=> false, 
> 'minYear' => date('Y') - 100, 
> 'maxYear' => date('Y') - 12
> )
> );
>
> I also tryed this at birthdate input configuration but it does not worked:
>
> 'format'=> ('d/m/Y')
>
>
> Does anybody know what am I doing wrong?
>
> Thanks
>
> Paulo Terra
>
>

-- 
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: Upgrade sage pay protocol v3 in cakephp 1.3

2015-06-18 Thread Gaurav Kumar
I have used that in CakePHP 2.6, implemented sage pay for buy online. There 
is nothing that you have to change just changes the version and in the 
response you will get some additional data from sage pay so if you are 
saving them then you can check it.

On Thursday, June 18, 2015 at 11:13:39 PM UTC+5:30, Eb ook wrote:
>
> Dear all,
>
> I'm using cakephp version 1.3 with.
>
> My website used sage pay for buy online. 
>
> The sagepay sent email for me. They suggested to upgrade protocol from 
> v2.23 to v3. 
>
> Can you help me upgrade it.
>
> Thanks regards.
>

-- 
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: Create plugin and run it my browser

2015-06-18 Thread Gaurav Kumar
The plugin name in the url should be snake case 
http://localhost/cakephp/contact_manager/Contacts 


On Tuesday, June 16, 2015 at 3:12:56 AM UTC+5:30, Scyllar wrote:
>
> http://book.cakephp.org/2.0/en/plugins/how-to-create-plugins.html
> i don't know run index.ctp in my browser. Please help me!
> in bootstrap.php
>
>> CakePlugin::load('ContactManager');
>>
>> in routes.php
>
> Router::connect('/', array('plugin' => 'ContactManager', 'controller' => 
> 'Contacts', 'action' =>'index'));
>
> http://i.imgur.com/tjPklMS.jpg
>
> ContactManagerAppController.php
>
> 
> ContactsController.php
>
>  public $uses = array('ContactManager.Contact');
>
> public function index() {
> //...
> }}
>
> ContactManagerAppModel.php
>
> 
> Contact.php
>
> class Contact extends ContactManagerAppModel {}
>
> How display index.ctp in my browser index.ctp
>
> 
>
> http://localhost/cakephp/ContactManager/Contacts --> wrong
> http://i.imgur.com/IrRFJKc.jpg 
>

-- 
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: Create plugin and run it my browser

2015-06-18 Thread Gaurav Kumar

Try to access this location http://localhost/cakephp/ 
 you will get your 
plugins index view. Because you have added route for plugin's index method 
on '/' that's why you can access your index method directly on the given 
location.

On Tuesday, June 16, 2015 at 3:12:56 AM UTC+5:30, Scyllar wrote:
>
> http://book.cakephp.org/2.0/en/plugins/how-to-create-plugins.html
> i don't know run index.ctp in my browser. Please help me!
> in bootstrap.php
>
>> CakePlugin::load('ContactManager');
>>
>> in routes.php
>
> Router::connect('/', array('plugin' => 'ContactManager', 'controller' => 
> 'Contacts', 'action' =>'index'));
>
> http://i.imgur.com/tjPklMS.jpg
>
> ContactManagerAppController.php
>
> 
> ContactsController.php
>
>  public $uses = array('ContactManager.Contact');
>
> public function index() {
> //...
> }}
>
> ContactManagerAppModel.php
>
> 
> Contact.php
>
> class Contact extends ContactManagerAppModel {}
>
> How display index.ctp in my browser index.ctp
>
> 
>
> http://localhost/cakephp/ContactManager/Contacts --> wrong
> http://i.imgur.com/IrRFJKc.jpg 
>

-- 
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: Login/Registration

2015-05-31 Thread Gaurav Kumar
I think you have to read the CakePHP docs then you will definitely get all 
the answers.

On Monday, June 1, 2015 at 3:09:15 AM UTC+5:30, sakshi bhalla wrote:
>
> All,
>
> I am new to Cake PHP. I am developing a website and struggling to complete 
> the initial login/registration page.
> Not sure, how should i link between html/css pages with my controller and 
> where should i authenticate user with my database.
> Can anyone share the general structure for login/registration for web app 
> using cake php.
>
>
> Thanks
> Sakshi
>

-- 
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: Unusual Table name/ Convention Naming issue

2015-05-31 Thread Gaurav Kumar
Please look after your controller's class name. If you changed your 
controller's name to "MyCallDatas1sController" then you also have to change 
the class name in the controller same as the file name. I think that should 
work.

On Monday, June 1, 2015 at 3:09:13 AM UTC+5:30, Troy White wrote:
>
> Hello I am having a naming convention problem that I would normally just 
> rename the table. However, that is not an option. 
>
> Background info:Table name is myCallDatas1
>
> I am trying to create a controller for this table. I went to 
> http://inflector.cakephp.org/ and it returned myCallDatas1s. I have tried 
> to use this as a controller(MyCallDatas1sController) name and I get the 
> following error message: Error: Create the class 
> MyCallDatas1sController.php. This table can not be renamed(it is attached 
> to mission critical appliances) is there a work around to fix this issue?
>

-- 
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: Schema migration in CakePHP-3

2015-03-10 Thread Gaurav Kumar
Thank you.

On Monday, March 9, 2015 at 10:33:28 AM UTC+5:30, Dakota wrote:
>
> How do you delete the table? If you simply run DROP TABLE too; then the 
> migration won't run again since Phinx still believes that the migration has 
> run. To undo a migration you need to run bin/cake migrations rollback

-- 
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: Input field returning "Array"

2015-03-09 Thread Gaurav Kumar
I just got the solution on #cakphp channel that because of change in RC3 
that was happening. So, for saving the file type fields create form with 
different name from database field name and in beforeSave assigned that 
form field value(name or tmp_name) into the database field name.

On Monday, March 9, 2015 at 10:54:34 AM UTC+5:30, Gaurav Kumar wrote:
>
> I have created a form in CakePHP-3 and in that there is an input type file 
> field. In previously getting the proper values(name, type, tmp_name, error) 
> of that input field. But now just updated the cakePHP and after doing 
> patchEntity the input field returning just "Array".
>

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


Input field returning "Array"

2015-03-08 Thread Gaurav Kumar
I have created a form in CakePHP-3 and in that there is an input type file 
field. In previously getting the proper values(name, type, tmp_name, error) 
of that input field. But now just updated the cakePHP and after doing 
patchEntity the input field returning just "Array".

-- 
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: Schema migration in CakePHP-3

2015-03-08 Thread Gaurav Kumar
On first run of the command "./bin/cake migrations migrate --plugin 
PluginName" the die() works, but if the table has been deleted and again 
running the migrate command the die() is not working.

On Thursday, March 5, 2015 at 6:54:52 PM UTC+5:30, José Lorenzo wrote:
>
> Can you put a die() in your migration file to see if it is being read?
>
> On Thursday, March 5, 2015 at 11:47:30 AM UTC+1, Gaurav Kumar wrote:
>>
>> Hello Everyone, 
>>
>> I am trying to create a custom plugin for CakePHP-3.0 where I want to 
>> include schema migrations [database sql queries] so that when plugin gets 
>> installed eventually migrations for the same plugin will run and tables 
>> required by the plugin will get created in users database. 
>>
>> I have created a Migration class under PluginName/config/Migrations/
>>
>> when I do "bin/cake migrations migrate --plugin pluginName" -- I am 
>> getting success message but when I check my database no table is created. 
>>
>> please find enclosed here with gist of migration class and output of the 
>> above command. 
>>
>> https://gist.github.com/aavrug/940634042245f9632d59
>>
>> Thank you. 
>>
>

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


Schema migration in CakePHP-3

2015-03-05 Thread Gaurav Kumar
Hello Everyone, 

I am trying to create a custom plugin for CakePHP-3.0 where I want to 
include schema migrations [database sql queries] so that when plugin gets 
installed eventually migrations for the same plugin will run and tables 
required by the plugin will get created in users database. 

I have created a Migration class under PluginName/config/Migrations/

when I do "bin/cake migrations migrate --plugin pluginName" -- I am getting 
success message but when I check my database no table is created. 

please find enclosed here with gist of migration class and output of the 
above command. 

https://gist.github.com/aavrug/940634042245f9632d59

Thank you. 

-- 
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: CakePHP-3 Plugins form validation messages and field values

2015-02-23 Thread Gaurav Kumar
Lorenzo,

I got the problem and the solution both. The problem was happening because 
of page reload. So now with the help of session i can fix that or I got 
modelless forms in cakephp which is also providing the solution. thanks for 
you help.

On Monday, February 23, 2015 at 1:57:41 PM UTC+5:30, José Lorenzo wrote:
>
> Can you show the code you are using? Use gist.github.com to show your 
> table class, controller and form code.
>
> On Thursday, February 19, 2015 at 7:19:22 AM UTC+1, Gaurav Kumar wrote:
>>
>> I have just created a CommentManager plugin. Created the comment form in 
>> post's view.ctp file and able to add the comments. But when the values of 
>> the comment form are wrong(email format is not proper or empty) then i am 
>> not getting the validation message in front of the respected fields and the 
>> values are not refilled.
>>
>> Also would like to know what would be the proper way to create a comment 
>> form inside a view file of posts.
>>
>

-- 
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: CakePHP 3 Plugin not working (controller file not found)

2015-02-19 Thread Gaurav Kumar
Hey HVan,

Change you autoload in composer.json with this

"autoload": {
"psr-4": {
"App\\": "src",
"ContactManager\\": "./plugins/ContactManager/src",
"ContactManager\\Test\\": "./plugins/ContactManager/tests"
}
}, 

On Sunday, February 8, 2015 at 9:28:58 PM UTC+5:30, HVan wrote:
>
> I followed all the instrucitons, even tried baking a plugin. But each time 
> I reference the plugin (eg. http://localhost/contact_manager/contacts) it 
> says Controller not found. All the files have been created and placed in 
> the proper location. It will say file not found in 
> /plugins/ContactManager/src/Controller/ContactsController.php and I've 
> tripled checked, of course, that the file exists. I also created the Table 
> file - nada.
>
> It's loading the plugin properly because when I remove, say bootstrap.php 
> inside the plugin, it will say the bootstrap file is not found inside the 
> plugin.
>
> Any ideas?
>

-- 
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 Plugins form validation messages and field values

2015-02-19 Thread Gaurav Kumar
I have just created a CommentManager plugin. Created the comment form in 
post's view.ctp file and able to add the comments. But when the values of 
the comment form are wrong(email format is not proper or empty) then i am 
not getting the validation message in front of the respected fields and the 
values are not refilled.

Also would like to know what would be the proper way to create a comment 
form inside a view file of posts.

-- 
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 not able to save associated model

2013-09-26 Thread Gaurav Kumar
(X-posting from 
SO
)

I've a model `CloudApp` which has HABTM relationship with `Policy` model 
e.g:

class CloudApp extends AppModel {
public $displayField = 'name';
public $hasAndBelongsToMany = array(
'Policy' => array(
'className' => 'Policy',
'joinTable' => 'cloudapp_policies',
'foreignKey' => 'cloud_app_id',
'associationForeignKey' => 'policy_id',
'unique' => 'keepExisting',
)
);

}

`Policy` model looks like this- 

class Policy extends AppModel {
public $belongsTo = 'CloudApp'; 
}




When I use scaffolding, everything works fine- I am able to multi-select 
policies for CloudApp that I am saving. 


But when I try to manually save data, associated data in Policy model is 
not getting saved.


Here is my `add` controller- 

public function add() {
$this->loadModel('Policy');
$this->set('policies', $this->Policy->find('list', array(
'fields' => array('Policy.name')
)));

if ($this->request->is('post')) {
pr($this->request->data);
$this->CloudApp->saveAll($this->request->data);}
}

add.ctp looks like this-


echo $this->Form->create('CloudApp');
?>


Form->input('name');
echo $this->Form->input('policies', array(
'multiple' => true
));

?>

Form->end(__('Submit')); ?>

Output of  `pr($this->request->data);` is- 

Array
(
[CloudApp] => Array
(
[name] => 123
[policies] => Array
(
[0] => 18
[1] => 19
[2] => 20
)

)

)


What am I doing wrong?

-- 
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/groups/opt_out.