Thursday, March 31, 2016

Please accept my invitation to join Magento Meetup São Paulo by Webjump

 
Meetup
 

Magento Meetup São Paulo by Webjump

Join Rodrigo Mourão and 32 other Mages in São Paulo. Be the first to hear about upcoming Meetups.
Este grupo é dedicado a aprender sobre a plataforma de eCommerce Magento. Nossos objetivos são proporcionar a oportunidade de compartilhar conhecimento e experiências sobre Magento, tais como customiz... (learn more)

This message was sent by Meetup on behalf of Rodrigo Mourão from Magento Meetup São Paulo by Webjump.

Questions? You can email Meetup Support at: support@meetup.com

Unsubscribe from this type of email.

Meetup Inc., POB 4668 #37895 New York NY USA 10163

Wednesday, March 30, 2016

Replacement Date Widget

I would like to replace the default date widget in CakePHP3 with the HTML5 date tag. I would have thought that was quite straight forward but have hit a dead end each time.
Does anyone have any example code that works here?

Justin


--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Looking for an experienced CakePHP developer

You can contact me,

On Wednesday, March 23, 2016 at 8:27:53 PM UTC+1, majna wrote:
Hi,

I'm looking for an experienced CakePHP 2.x developer, freelance, remote, long-term.
Please LMK if you know somebody.

Thanks!
majna

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Help me design the database structure

Hello Everyone,

I am working on an application, a document management/versioning system.

The admin will need to add a user to a document before the user will be able to see the document, Furthermore, the admin will add a maximum number of 3 different reviewer to a particular document.

How do I design this database table? your help would be appreciated.

Thanks

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sunday, March 27, 2016

Re: CakePHP 3 Role Authorization for controllers and methods

I use https://github.com/dereuromark/cakephp-tinyauth to exactly prevent this complicated if/switch statement logic from happening all over the controllers ;)
One simple to configure ini file, done.
Mark


Am Sonntag, 27. März 2016 11:43:31 UTC+2 schrieb LSRX4EVER:
Hello Everyone,

I'm a beginner CakePHP 3 developer. I learned fairly quick for my skill level. 
I'm currently working on a management system for a school, where there will be a couple of roles that will only access specific controller functions. (Student, Instructor, Supervisor, Administrator)
HOWEVER, each user has a user state that I must validate and set permission temporarily for users
Example:

Active User
LoginEnter code here...
Redirected to their role controller, with only access to those methods in that controller

Inactive User (used for setup)
Login
Confirm Account Information
only aloud to access that setup() action
once confirmed, it will set the user active and log them out

Disabled User
Is disabled, unauthorized user. Already have that configured


My login function looks like:
public function login()
{
$this->viewBuilder()->layout('login');
if($this->Auth->user()){
return $this->redirect(['controller'=>'Users','action'=>'index']); //index redirect for now
} else {
if($this->request->is('post')){
$user = $this->Auth->identify();
$login_error=null;
if($user){
$session = $this->request->session(); 
switch($user['user_status']){
case '1': //Active - Normal Login
unset($user['created'], $user['expiration'], $user['user_status'], $user['security_question_answer'], $user['security_question_id'], $user['modified']);
$userid=$user['id'];
//$user= array_merge($user, array('Roles' => $this->Users->Roles->find('list', ['order' => ['Roles.role_id' => 'ASC']])->matching('Users', function ($q) use ($userid) {return $q->where(['Users.id' => $userid]);})->toArray()));
$user = array_merge($user, array('role'=>key($this->Users->Roles->find('list', ['order' => ['Roles.role_id' => 'ASC']])->select(['Roles.role_id'])->matching('Users', function ($q) use ($userid) { return $q->where(['Users.id' => $userid]);})->limit(1)->toArray())));
$user = array_merge($user, array('user_status' => 1));
$this->Auth->setUser($user);
return $this->redirect($this->Auth->redirectUrl('/users/index'));
break;
case '2': //Disabled 
$login_error=1;
$this->set(compact('login_error'));
break;
case '3': //Inactive - Redirect to setup method
unset($user['created'], $user['expiration'], $user['user_status'], $user['security_question_answer'], $user['security_question_id'], $user['modified']);
$userid=$user['id'];
//$user= array_merge($user, array('roles' => $this->Users->Roles->find('list', ['order' => ['Roles.role_id' => 'ASC']])->matching('Users', function ($q) use ($userid) {return $q->where(['Users.id' => $userid]);})->toArray()));
$user = array_merge($user, array('role'=>key($this->Users->Roles->find('list', ['order' => ['Roles.role_id' => 'ASC']])->select(['Roles.role_id'])->matching('Users', function ($q) use ($userid) { return $q->where(['Users.id' => $userid]);})->limit(1)->toArray()), 'status' => 3));
$this->Auth->setUser($user); //Auth Role to only allow inactive user privilage to login, recovery and setup?
/*this isnt right*/ return $this->redirect($this->Auth->redirectUrl('/users/setup'));
break;
}
if($login_error!=1){
$login_error=0;
};
$this->set(compact('login_error'));
}
}
}

My AppController BeforeFilter looks like:
public function beforeFilter(Event $event)
{
$this->Auth->allow(['/users/login', '/users/recovery']);
/*
switch(user_status){
case 'Active'
switch(role){
case 'Student'
allow student controller methods
break;
case 'Supervisor'
allow supervisor controller methods
break;
case 'Instructor'
allow instructor controller methods
break;
case 'Administrator'
allow administrator controller methods
break;
}
deny login and recovery methods
break;
case 'Inactive'
allow setup and logout methods
deny login and recovery methods
break;
default:
allow login and recovery methods
break;
}
*/
}


I have looked at some things, I am running a basic authentication system and I heard of Access Control Lists (ACL), but its seemed quite intricate and I don't want to spend a week trying to figure something out that's far from my reach.

Any suggestions how to accomplish this?

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

CakePHP 3 Role Authorization for controllers and methods

Hello Everyone,

I'm a beginner CakePHP 3 developer. I learned fairly quick for my skill level. 
I'm currently working on a management system for a school, where there will be a couple of roles that will only access specific controller functions. (Student, Instructor, Supervisor, Administrator)
HOWEVER, each user has a user state that I must validate and set permission temporarily for users
Example:

Active User
LoginEnter code here...
Redirected to their role controller, with only access to those methods in that controller

Inactive User (used for setup)
Login
Confirm Account Information
only aloud to access that setup() action
once confirmed, it will set the user active and log them out

Disabled User
Is disabled, unauthorized user. Already have that configured


My login function looks like:
public function login()
{
$this->viewBuilder()->layout('login');
if($this->Auth->user()){
return $this->redirect(['controller'=>'Users','action'=>'index']); //index redirect for now
} else {
if($this->request->is('post')){
$user = $this->Auth->identify();
$login_error=null;
if($user){
$session = $this->request->session(); 
switch($user['user_status']){
case '1': //Active - Normal Login
unset($user['created'], $user['expiration'], $user['user_status'], $user['security_question_answer'], $user['security_question_id'], $user['modified']);
$userid=$user['id'];
//$user= array_merge($user, array('Roles' => $this->Users->Roles->find('list', ['order' => ['Roles.role_id' => 'ASC']])->matching('Users', function ($q) use ($userid) {return $q->where(['Users.id' => $userid]);})->toArray()));
$user = array_merge($user, array('role'=>key($this->Users->Roles->find('list', ['order' => ['Roles.role_id' => 'ASC']])->select(['Roles.role_id'])->matching('Users', function ($q) use ($userid) { return $q->where(['Users.id' => $userid]);})->limit(1)->toArray())));
$user = array_merge($user, array('user_status' => 1));
$this->Auth->setUser($user);
return $this->redirect($this->Auth->redirectUrl('/users/index'));
break;
case '2': //Disabled 
$login_error=1;
$this->set(compact('login_error'));
break;
case '3': //Inactive - Redirect to setup method
unset($user['created'], $user['expiration'], $user['user_status'], $user['security_question_answer'], $user['security_question_id'], $user['modified']);
$userid=$user['id'];
//$user= array_merge($user, array('roles' => $this->Users->Roles->find('list', ['order' => ['Roles.role_id' => 'ASC']])->matching('Users', function ($q) use ($userid) {return $q->where(['Users.id' => $userid]);})->toArray()));
$user = array_merge($user, array('role'=>key($this->Users->Roles->find('list', ['order' => ['Roles.role_id' => 'ASC']])->select(['Roles.role_id'])->matching('Users', function ($q) use ($userid) { return $q->where(['Users.id' => $userid]);})->limit(1)->toArray()), 'status' => 3));
$this->Auth->setUser($user); //Auth Role to only allow inactive user privilage to login, recovery and setup?
/*this isnt right*/ return $this->redirect($this->Auth->redirectUrl('/users/setup'));
break;
}
if($login_error!=1){
$login_error=0;
};
$this->set(compact('login_error'));
}
}
}

My AppController BeforeFilter looks like:
public function beforeFilter(Event $event)
{
$this->Auth->allow(['/users/login', '/users/recovery']);
/*
switch(user_status){
case 'Active'
switch(role){
case 'Student'
allow student controller methods
break;
case 'Supervisor'
allow supervisor controller methods
break;
case 'Instructor'
allow instructor controller methods
break;
case 'Administrator'
allow administrator controller methods
break;
}
deny login and recovery methods
break;
case 'Inactive'
allow setup and logout methods
deny login and recovery methods
break;
default:
allow login and recovery methods
break;
}
*/
}


I have looked at some things, I am running a basic authentication system and I heard of Access Control Lists (ACL), but its seemed quite intricate and I don't want to spend a week trying to figure something out that's far from my reach.

Any suggestions how to accomplish this?

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Friday, March 25, 2016

Re: [Cakephp 3.2.5] Cannot match provided foreignKey

Argh, what a stupid mistake....

Not sure why I forgot to add primary indices, but adding them did the trick. Not a very helpful error message though.

Thanks for the help!

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: [Cakephp 3.2.5] Cannot match provided foreignKey

In addition to the other reply, i recommend that you use the bake utility to bake your models so that all of the needed files are created along with the correct syntax.


from a dos command prompt, cd to your application folder that contains your bin and src folders and issue the following commands:
bin\cake bake model Users
bin\cake bake model Articles

in addition, you may want to bake your controllers and templates but make sure you don't overwrite any code that you have already written there...
With your tables created correctly and the code baked everything should work as expected.

regards,
--Kevin

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: CakePHP 3 + MSSQL = slow query

Is there any reason you are not paging it and fetching only 20, or 50 or 100 records at a time?  That would significantly speed things up for you...
Regards,
--Kevin

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thursday, March 24, 2016

Re: [Cakephp 3.2.5] Cannot match provided foreignKey

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:

<?php
namespace App\Model\Table;
use Cake\ORM\Table;

class UsersTable extends Table
{
    public function initialize(array $config){
    }
}

src/Model/Table/ArticlesTable.php:

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

<?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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wednesday, March 23, 2016

Re: Looking for an experienced CakePHP developer

Hi,

I have sent you an email. Please find my CakePHP 2.x works here http://neptunescripts.com

Best regards,
Zhaff

On Thursday, March 24, 2016 at 3:27:53 AM UTC+8, majna wrote:
Hi,

I'm looking for an experienced CakePHP 2.x developer, freelance, remote, long-term.
Please LMK if you know somebody.

Thanks!
majna

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Looking for an experienced CakePHP developer

Hi,

I can help  you

El 23/3/2016 16:28, "majna" <majnaggz@gmail.com> escribió:
Hi,

I'm looking for an experienced CakePHP 2.x developer, freelance, remote, long-term.
Please LMK if you know somebody.

Thanks!
majna

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Looking for an experienced CakePHP developer

maybe i can help U

2016-03-23 20:27 GMT+01:00 majna <majnaggz@gmail.com>:
Hi,

I'm looking for an experienced CakePHP 2.x developer, freelance, remote, long-term.
Please LMK if you know somebody.

Thanks!
majna

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Looking for an experienced CakePHP developer

Hi,

I'm looking for an experienced CakePHP 2.x developer, freelance, remote, long-term.
Please LMK if you know somebody.

Thanks!
majna

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[Cakephp 3.2.5] Cannot match provided foreignKey

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:

<?php
namespace App\Model\Table;
use Cake\ORM\Table;

class UsersTable extends Table
{
    public function initialize(array $config){
    }
}

src/Model/Table/ArticlesTable.php:

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

<?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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tuesday, March 22, 2016

Re: php requirements for 3.X

Hello Mike,

5.5.31 is greater than 5.5.5.9 so it will work fine.

http://book.cakephp.org/3.0/en/installation.html#requirements
• PHP 5.5.9 or greater (including PHP 7).



Andras


> On Mar 22, 2016, at 5:55 PM, MikeK <Michael.Kogan@gmail.com> wrote:
>
> Thanks for your eloquent reply - HOWEVER the latest stable release of php 5.5 is 5.5.31 - there is no 5.5.9 as the "requirements" call for. Does anyone really know what cakephp3 REALLY requires?
>
>
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: php requirements for 3.X

Thanks for your eloquent reply - HOWEVER the latest stable release of php 5.5 is 5.5.31 - there is no 5.5.9 as the "requirements" call for. Does anyone really know what cakephp3 REALLY requires?


--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: [Cakephp 2.8.1] Multiple assosication to one model with habtm throws a notice

Hi,

i checked your solution, but it occurs the same error.

    public $hasAndBelongsToMany = array (
           
'Owners' => array (
                   
'className' => 'User',
                   
'with' => 'PermissionOwner',
           
),
           
'Rights' => array (
                   
'className' => 'User',
                   
'with' => 'PermissionRight',
           
)
   
);

Notice (8): Undefined index: User [CORE\Cake\Model\Datasource\DboSource.php, line 1388]



On Monday, March 14, 2016 at 8:29:13 PM UTC+1, John Andersen wrote:
Check your model names in the HABTM relationships. Looks like you have a mix of singular and plural.
Enjoy, John

On Monday, 14 March 2016 05:33:36 UTC+2, Steffen Reinig wrote:
Hello Cakephp Fans,

today i receive these error:

Notice (8): Undefined index: User [CORE\Cake\Model\Datasource\DboSource.php, line 1388]

Its easy to reproduce:

Model: User belongsTo Group
Model: Permission habtm Rights (className User)
Permission habtm Owners (className User)

When i use now
$this->Permission->find('all', array('recursive' => -2));

the notice will be thrown. But only for the 2nd habtm.

The output is like:
array(
       
'Permission' => array(
               
'id' => '6',
       
),
       
'Owner' => array(
               
(int) 0 => array(
                       
'id' => '499',
                       
'PermissionOwner' => array(
                               
'id' => '6',
                               
'user_id' => '499',
                               
'permission_id' => '6'
                       
)
               
)
       
),
       
'Rights' => array(
               
(int) 0 => array(
                       
'id' => '485',
                       
'PermissionRight' => array(
                               
'id' => '18',
                               
'permission_id' => '6',
                               
'user_id' => '485',
                       
),
                       
'Group' => array()
               
),
               
(int) 1 => array(
                       
'id' => '124',
'PermissionRight'                                'id' => '19',
                               
'permission_id' => '6',
                               
'user_id' => '124',
                       
),
                       
'Group' => array()
               
)
       
)
)



Kind Regards

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Monday, March 21, 2016

Cakephp Upload to a sub directory is giving issues

Hi everyone, I just completed a cakephp project with cake 2.x locally , every thing works perfectly.

Now, I moved it online and uploaded to a sub directory, http://doubleedgetechnologies.com.ng/unlimitedgrace/

but below is the error I am getting, I know is .htaccess issue, I have struggled with it for over 3 hours all to no avail.

Please help me out.

Thanks

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@doubleedgetechnologies.com.ng and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.


--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Friday, March 18, 2016

Re: php requirements for 3.X

The requirement *is* a requirement.


Am Freitag, 18. März 2016 14:32:03 UTC+1 schrieb MikeK:
Am migrating to 3.2 from cakephp 2.x, but my host only offers php 5.4 - I saw the install requirements want 5.5.9

Should I find another host or will 3.2 operate OK on 5.4?

Thanks in advance and sorry if this is a dup - could not find an answer by search.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

php requirements for 3.X

Am migrating to 3.2 from cakephp 2.x, but my host only offers php 5.4 - I saw the install requirements want 5.5.9

Should I find another host or will 3.2 operate OK on 5.4?

Thanks in advance and sorry if this is a dup - could not find an answer by search.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mutliple validation not working

Hi,

I am using cakephp version 3, i am trying to add multiple validation but its not working on password field

$validator = new Validator();
       $validator
                ->requirePresence('email', 'create')
                ->notEmpty('email',['message'=>__('Please enter email address.')])
->add('email', 'email', ['rule' => 'email', 'message'=>__('Please enter valid email address.')])
                ->add('email', 'unique', ['rule' => 'validateUnique', 'provider' => 'table','message'=>__('This Email is already taken.')])
                ->requirePresence('password','create')
->add('password', [
'length' => [
'rule' => ['minLength', 6],
'message' => 'Password need to be at least 6 characters long',
])
               ->notEmpty('password',['message'=>__('Please enter password.')])
->add('password','length',['rule' => ['minLength',6],'message' => __('Password should be minimum 6 character long.')])
->requirePresence('repassword', 'create')
->notEmpty('repassword',['message'=>__('Please enter Confirm Password.')])
->add('repassword','customLength',[
                    'rule' => function($value, $context) {
                        if (trim($context['repassword']) != trim($context['password'])) {
                            return false;
                        }else{
return true;
}
                        return false;
                    },
                    'message' => __('Password and confirm password did not matched.'),
]);
return $validator;


Thanks,
Marcus

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thursday, March 17, 2016

Re: How to set a variable and use everywhere?

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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.