Thanks for responding.
So i might NOT be crazy???
The 3 you identified as the ID isn't - it's the array index for that listing field. See the inputs again. "Parking" is index 3, its record ID is 1. i wouldn't want to insert 3 as the listings_attributes.attribute_id.
i re-baked the Tables, Entity, and Controller classes as you suggested. While there were some minor discrepancies i merged into the originals, it doesn't seem the re-bakes are working either.
The chief difference in the controller:
Original:
Re-baked:
Just as you reported, i can manage to save the Listings record under some variations, but never the ListingsAttributes record(s). i can't see anything in the documentation i'm skipping, either. Also as you mentioned, when i patch the Listing entity (or create it directly from request data), the association (attributes) data from request disappears.
i was actually surprised by the docs update, which is why i came back to revisit this issue. Even with the updated documentation, i haven't managed to make the joint table data save. i suppose i'll have to force it in by creating a separate entity, but i don't think that's how the Cake magic is supposed to work...
Thanks for following up, and (at least tentatively) confirming i'm not insane with this issue. ;-)
-joe
On Sunday, 22 February 2015 17:39:52 UTC-5, heavyKevy wrote:
-- So i might NOT be crazy???
The 3 you identified as the ID isn't - it's the array index for that listing field. See the inputs again. "Parking" is index 3, its record ID is 1. i wouldn't want to insert 3 as the listings_attributes.attribute_id.
i re-baked the Tables, Entity, and Controller classes as you suggested. While there were some minor discrepancies i merged into the originals, it doesn't seem the re-bakes are working either.
The chief difference in the controller:
Original:
// i've also tried a few variants of this, where either nothing gets saved, or only the Listing record.
$listing = $this->Listings->newEntity($this->request->data, ['associated' => ['Attributes._joinData']]);
$listing = $this->Listings->newEntity();
$listing = $this->Listings->patchEntity($listing, $this->request->data);
Just as you reported, i can manage to save the Listings record under some variations, but never the ListingsAttributes record(s). i can't see anything in the documentation i'm skipping, either. Also as you mentioned, when i patch the Listing entity (or create it directly from request data), the association (attributes) data from request disappears.
i was actually surprised by the docs update, which is why i came back to revisit this issue. Even with the updated documentation, i haven't managed to make the joint table data save. i suppose i'll have to force it in by creating a separate entity, but i don't think that's how the Cake magic is supposed to work...
Thanks for following up, and (at least tentatively) confirming i'm not insane with this issue. ;-)
-joe
On Sunday, 22 February 2015 17:39:52 UTC-5, heavyKevy wrote:
I took the time to construct a test project with the 3 join tables and was able to get data that looks like the documentation requires, but it refuses to save.
The joint marshaller chokes because no listing_id, and no attribute_id is found when marshalling the _joinData.
I don't see in the documentation what else needs to be included to ensure that the attributes are saved.
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+unsubscribe@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.
No comments:
Post a Comment