Re: Creating Associated Records with CakePHP 3.0 ORM

2015-02-16 Thread Harold Putman
That was a clue! The problem was that I was calling patchEntity() using only the customer_id. patchEntity validates the stuff you are "patching" with instead of the resulting entity so, it flagged errors on the missing values. IMO that is unexpected behavior, but it can be remedied with ['val

Re: Creating Associated Records with CakePHP 3.0 ORM

2015-02-16 Thread Harold Putman
No sorry, I was retyping and my eyesight is bad ;-) What I am finding as I dig deeper is that somehow I am getting errors in the user Entity that username and password fields are required even though they are set: object(App\Model\Entity\User) { 'new' => true, 'accessible' => [ 'username' => t

Re: Creating Associated Records with CakePHP 3.0 ORM

2015-02-16 Thread Andrew Lechowicz
Is that directly copied/pasted? If so, do you mean to have a 'Users=> patchEntity' in this line: $user = $this->Customers->Users=>patchEntity($user, ['customer_id' => $cr-> get('id')]); Notice the double arrow (=>)? On Monday, February 16, 2015 at 6:45:40 AM UTC-5, Harold Putman wrote: > > Hi, >

Creating Associated Records with CakePHP 3.0 ORM

2015-02-16 Thread Harold Putman
Hi, I am having trouble creating new records that are in a BelongsTo association Two tables: Users and Customers. User = [id, username, customer_id] Customer = [id, firstname, lastname] I have a form where someone can enter username, firstname, and lastname. I want to create a new Customer rec