|
[
Permalink
| « Hide
]
Jonathan H. Wage added a comment - 18/Nov/09 01:47 AM
It's because of actAs, it is because the behavior you actAs adds its own record listener, which overrides the manager. I believe this is the real issue.
That sounds like what I'm seeing; however, I should also note that it works perfectly fine to add multiple behaviors (my test model acts as timestampable, sluggable, versionable, searchable and softdelete) ...all of their listeners fire exactly as expected; it's just when you add a listener manually to the manager that it fails.
Given that, I suppose one possible workaround would be to bundle my new listener into a custom behavior ...but for that to work globally, I'd need to attach it at the schema level to every one of my models. It'd certainly be more convenient to be able to add it to the manager instead. In any case, thanks for looking into this! The multiple actAs all work because the listeners for each behavior are attached to the table level, overriding anything that was set at the connection or manager level. It works by going through the hierarchy checking if each level has listeners where table has the highest precedence. I think this was specifically designed this way so I am not sure if it can be "patched"..Will have to look.
I just spent 3 hours trying to figure out why my sanitise listener was not firing for specific tables, and finally came to this conclusion here after much debugging. As Wage has said, it is not the actAs but rather the addition of another listener on the template/record/table level.
This is a real misleading "by design" if it is, as the documentation never mentions such an override so naturally you expect manager and connection listeners to continue to work. I will have to add a sanitise template and add it manually to records that use other templates with listeners for the meantime. But again, this is the most annoying bug I've ever experienced with doctrine so far, and has caused me to storm around the office in near rage prepared to throw doctrine out a window! If this won't be fixed (which I'm dearly hoping it will to prevent any unexpected issues for future developers), then please add a huge disclaimer in the documentation informing the users about this feature. For myself, I'm particularly shocked as I was using a global level listener for stripping html out of all the fields that weren't set as html fields, so when suddenly javascript was starting to run in particular records, it started getting to risky business! Going to be a long haul ensuring that previous sites implemented remain secure. |
||||||||||||||||||||||||||||||||||||||||