# |
Feb 11th 2018, 04:43 |
slackebot1 |
$this->Items->save($item); debug($item); } |
# |
Feb 11th 2018, 04:43 |
slackebot1 |
'available' => 1]] ] ]; $item = $this->Items->newEntity(); $item = $this->Items->patchEntity($item, $data,[ 'associated' => ['Groups'=> ['associated'=> ['Options']]]]); //debug($item); debug($this->request->getData()); /*$item->groups = []; $item->groups[] = ['name' => 'color', 'required' => 1, 'type' => 'checkbox']; $item->dirty('groups', true);*/ |
# |
Feb 11th 2018, 04:43 |
humbba12 |
public function new1() { $data = [ 'sku' => 'd489rfsdf4rfdfsdf3', 'name' => 'blusa', 'price' => 10, 'unit' => 'pieza', 'groups' => [ ['name' => 'color', 'required' => 1, 'type' => 'checkbox', 'options' => ['name' => 'verde', 'value' => 10.2, |
# |
Feb 11th 2018, 04:43 |
ricksaccous |
lol |
# |
Feb 11th 2018, 04:43 |
ricksaccous |
wat |
# |
Feb 11th 2018, 04:43 |
humbba12 |
just [] |
# |
Feb 11th 2018, 04:43 |
humbba12 |
its empty |
# |
Feb 11th 2018, 04:43 |
ricksaccous |
the debug($this->request->getData()); |
# |
Feb 11th 2018, 04:43 |
ricksaccous |
$this->request->getData() |
# |
Feb 11th 2018, 04:43 |
ricksaccous |
now let me see this |
# |
Feb 11th 2018, 04:42 |
humbba12 |
File uploaded https://cakesf.slack.com/files/U6DMU08AE/F9849DZU6/-.php / https://slack-files.com/T053DPNCM-F9849DZU6-96ccb5a4dd - now with options in the array |
# |
Feb 11th 2018, 04:42 |
humbba12 |
I see |
# |
Feb 11th 2018, 04:41 |
ricksaccous |
you see? |
# |
Feb 11th 2018, 04:40 |
ricksaccous |
oops |
# |
Feb 11th 2018, 04:40 |
ricksaccous |
protected $_accessible = [ 'name' => true, 'required' => true, 'description' => true, 'type' => true, 'order' => true, 'item_id' => true, 'item' => true, 'groups_options' => true, 'orders_details' => true, ]; |
# |
Feb 11th 2018, 04:39 |
ricksaccous |
to that array |
# |
Feb 11th 2018, 04:39 |
ricksaccous |
you need to add options |
# |
Feb 11th 2018, 04:39 |
slackebot1 |
=> true, 'required' => true, 'description' => true, 'type' => true, 'order' => true, 'item_id' => true, 'item' => true, 'groups_options' => true, 'orders_details' => true ]; } |
# |
Feb 11th 2018, 04:39 |
humbba12 |
class Group extends Entity { /** * Fields that can be mass assigned using newEntity() or patchEntity(). * * Note that when '*' is set to true, this allows all unspecified fields to * be mass assigned. For security purposes, it is advised to set '*' to false * (or remove it), and explicitly make individual fields accessible as needed. * * @var array */ protected $_accessible = [ 'name' |
# |
Feb 11th 2018, 04:39 |
ricksaccous |
Entity/Group.php |
# |
Feb 11th 2018, 04:38 |
ricksaccous |
you should do that |
# |
Feb 11th 2018, 04:38 |
ricksaccous |
also did you make options accessible in your groups entity? |
# |
Feb 11th 2018, 04:38 |
ricksaccous |
I wanted to see this? $this->request->getData() |
# |
Feb 11th 2018, 04:34 |
humbba12 |
File uploaded https://cakesf.slack.com/files/U6DMU08AE/F96JUGD32/-.php / https://slack-files.com/T053DPNCM-F96JUGD32-7f1a4feb3f - this is the request object with new1 function |
# |
Feb 11th 2018, 04:32 |
ricksaccous |
yeah no problem |
# |
Feb 11th 2018, 04:32 |
humbba12 |
okay give me a second pls |
# |
Feb 11th 2018, 04:32 |
ricksaccous |
possibly* |
# |
Feb 11th 2018, 04:31 |
ricksaccous |
that is possible the problem |
# |
Feb 11th 2018, 04:31 |
ricksaccous |
you should make them accessible |
# |
Feb 11th 2018, 04:31 |
ricksaccous |
options are not accessible in groups |
# |
Feb 11th 2018, 04:31 |
ricksaccous |
also |
# |
Feb 11th 2018, 04:31 |
ricksaccous |
now show request data |
# |
Feb 11th 2018, 04:31 |
ricksaccous |
yes |
# |
Feb 11th 2018, 04:29 |
humbba12 |
File uploaded https://cakesf.slack.com/files/U6DMU08AE/F975NCSCB/-.php / https://slack-files.com/T053DPNCM-F975NCSCB-5036af6ceb - I guess this is what you mean |
# |
Feb 11th 2018, 04:28 |
ricksaccous |
also can you show the debugs from the new method in the controller? just exit after the debugs then paste the actual data |
# |
Feb 11th 2018, 04:27 |
ricksaccous |
and you can nest it like 'Groups' => ['Options'] |
# |
Feb 11th 2018, 04:27 |
ricksaccous |
just one will do |
# |
Feb 11th 2018, 04:27 |
ricksaccous |
i don't think you need multiple 'associated' in that array |
# |
Feb 11th 2018, 04:26 |
ricksaccous |
debug item around where you are debugging the request data |
# |
Feb 11th 2018, 04:26 |
humbba12 |
File uploaded https://cakesf.slack.com/files/U6DMU08AE/F98A6KN9M/-.php / https://slack-files.com/T053DPNCM-F98A6KN9M-82b4b12f77 - and I made this for testing the new changes to the database |
# |
Feb 11th 2018, 04:25 |
humbba12 |
File uploaded https://cakesf.slack.com/files/U6DMU08AE/F975N2R8T/this_is_the_original_one_before_i_added_the_groups_and_options_to_database.php / https://slack-files.com/T053DPNCM-F975N2R8T-fea512eba6 |