i absolutely cannot believe this: it's broken again. i haven't done 
anything but run *composer update* and i'm back to losing the 
[_joinData][value] from request data when i patch the entity, so the joint 
table record inserts NULL. It DOES insert, but the _joinData is GONE from 
the entity.

Is there any chance it's related to this issue? 
https://github.com/cakephp/cakephp/issues/6050

Now what?


On Sunday, 8 March 2015 00:40:49 UTC-5, Joe T. wrote:
>
> Kevin,
>
> i'm so grateful for all your effort & ideas. i don't fully grasp 
> conditional validation yet, though i suspect i will have to address that 
> sooner or later. When i re-baked the models, ->requirePresence('field_name', 
> 'create') is already set by default in *AttributesTable*, so that got me 
> nowhere.
>
> i also tried making a one-stop association like so:
> <input type="checkbox" name="listings_attributes[3][attribute_id]" value=
> "1">
> <input type="text" name="listings_attributes[3][value]"> <!-- Off-street 
> -->
>
> Then in the Controller:
> $listing = $this->Listings->patchEntity($listing, $this->request->data, [
> 'associated' => ['ListingsAttributes']]);
>
> It didn't produce any entity errors, but it didn't save the 
> ListingsAttributes record, either. The data never makes it to the entity.
>
> What i ultimately had to do (though it feels *really* dirty) was your 
> initial suggestion: add all the *attribute* fields as hidden inputs. 
> However, that added another problem: ALL the attributes were being 
> submitted because the hidden fields were enabled for POSTing. So i had to 
> tweak the Javascript that presents a text input for the join data (value) 
> to also toggle the [*disabled*] property of all the hidden inputs for a 
> given Attribute check box.
>
> i'm *FINALLY* getting data in the ListingsAttributes table. i'm not a fan 
> of doing it this way, but i'll have to live with it for now.
>
> i really think there should be an option to tell the ORM to stop the save 
> at the join table, rather than always trying to update the linked record in 
> the associated table. If there is a way to do this with the ORM's save 
> options, it doesn't appear to be documented. Obviously, i followed the 
> documentation to the letter, but my assumption of its behavior was wrong.
>
> Thanks again!
> -joe
>
>
> On Saturday, 7 March 2015 13:21:56 UTC-5, heavyKevy wrote:
>>
>> I thought of one more option... 
>>
>> You can specify a separate validation specifically for adding the listing 
>> attributes such that the usual validation continues to be used and work as 
>> it was and the new validation works only for this instance.   The 
>> documentation has all of the information on how to do this should you 
>> decide to choose this option...
>
>

-- 
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/d/optout.

Reply via email to