#

#

As mentioned by Kary Leong, this will not work on cli mode, which includes:

loading of fixtures

unit testing

functional testing

this is a recurring problem with sfContext, and you should avoid using it anyway.

One possible solution could be, before using sfContext, checking if the created_by and updated_by are already (this let the dev the chance to fill them, avoiding the sfContext exception) and/or to check for a context using sfContext::hasInstance();

As a side note, the "type: string" parameter would better trigger a __toString() call as this is the standard way to get a string representation from an object