3.0 OpsWorks setup

2014-03-02 Thread Robert Meisner
Has any1 any luck configuring Amazon OpsWorks with dev version of cakephp?
Would be great if some1 could share configuration to make it work.

I tired to connect it with https://github.com/cakephp/cakephp.git  but all 
i can see is empty response on me EC2 instance.

R

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


Re: 3.0 update/save complex relations

2014-02-19 Thread Robert Meisner
I made an Issue for you :P
https://github.com/cakephp/cakephp/issues/2868

W dniu środa, 19 lutego 2014 11:11:10 UTC+1 użytkownik José Lorenzo napisał:

 That is unfortunately not done yet, currently it is only possible to 
 hydrate a new entity. Also there are some tasks pending for building the 
 options arrays so you don't have to type 'associated' so many times :P

 The only real way you can do it *right now* is to traverse you entity 
 yourself and set the values on your own. Would you like to help us getting 
 this done?

 On Tuesday, February 18, 2014 7:25:36 PM UTC+1, Robert Meisner wrote:

 I've started playing with new cakephp ORM functionality and i stuck with 
 complex relation updates/saves.

 Example relations look like this:
 Customer hasMany CustomerDetails
 CustomerDetails hasMany Attributes
 Attributes hasMany AttributeValues

 CustomerController:: view() action pases $customer entity variable 
 (contains all relations) to view. 
 Variable is then used in view to echo entity data but also is passed to 
 Form-create($customer) to edit part of the data
 I build my forms using notation below:
 $this-Form-hidden(id);
 $this-Form-text(
 customer_details.0.attributes.0.attribute_values.0.name)

 After user sends data i want to populate all $customer entity variable 
 with $this-request-data then try to save it and finally pass to view 
 again (this way all related entities should have validation errors 
 included):
  public function view($customer_id){
 
 $this-Customers = TableRegistry::get ( 'Customers' );
 /* @var $customer Customer */
 
 $customer=$this-Customers-find()-where(['Customers.id'=$customer_id])-contain([CustomerDetails=[Attributes=[AttributeValues]]])-first();
 if($this-request-is(post)){
  
 *$customer-populate($this-request-data,['associated'=['CustomerDetails'=
  
 ['associated' = ['Attributes'= ['associated' = 
 ['AttributesValues']]); //hydrate??*
 if($this-Customers-save($customer,['associated'=['CustomerDetails'= 
 ['associated' = ['Attributes'= ['associated' = 
 ['AttributesValues']])){
 //Yay
 }
 }
 $this-set(compact('customer'));
 }

 $this-request-data looks like this after send:

  'id' = '1',
  'customer_details' = array(
  (int) 0 = array(
  'id' = '1',
  'attributes' = array(
  (int) 0 = array(
  'id' = '1',
  'attributes_values' = array(
  (int) 0 = array(
  'string_value' = 'test 
 test test'
  )
  )
  ),
  (int) 1 = array(
  'name' = 'love',
  'attributes_values' = array(
  (int) 0 = array(
  'string_value' = '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 http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


3.0 update/save complex relations

2014-02-18 Thread Robert Meisner
I've started playing with new cakephp ORM functionality and i stuck with 
complex relation updates/saves.

Example relations look like this:
Customer hasMany CustomerDetails
CustomerDetails hasMany Attributes
Attributes hasMany AttributeValues

CustomerController:: view() action pases $customer entity variable 
(contains all relations) to view. 
Variable is then used in view to echo entity data but also is passed to 
Form-create($customer) to edit part of the data
I build my forms using notation below:
$this-Form-hidden(id);
$this-Form-text(customer_details.0.attributes.0.attribute_values.0.name)

After user sends data i want to populate all $customer entity variable with 
$this-request-data then try to save it and finally pass to view again 
(this way all related entities should have validation errors included):
 public function view($customer_id){

$this-Customers = TableRegistry::get ( 'Customers' );
/* @var $customer Customer */

$customer=$this-Customers-find()-where(['Customers.id'=$customer_id])-contain([CustomerDetails=[Attributes=[AttributeValues]]])-first();
if($this-request-is(post)){
 
*$customer-populate($this-request-data,['associated'=['CustomerDetails'= 
['associated' = ['Attributes'= ['associated' = 
['AttributesValues']]); //hydrate??*
if($this-Customers-save($customer,['associated'=['CustomerDetails'= 
['associated' = ['Attributes'= ['associated' = 
['AttributesValues']])){
//Yay
}
}
$this-set(compact('customer'));
}

$this-request-data looks like this after send:

'id' = '1',
'customer_details' = array(
(int) 0 = array(
'id' = '1',
'attributes' = array(
(int) 0 = array(
'id' = '1',
'attributes_values' = array(
(int) 0 = array(
'string_value' = 'test 
test test'
)
)
),
(int) 1 = array(
'name' = 'love',
'attributes_values' = array(
(int) 0 = array(
'string_value' = '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 http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.