You should define the context->customer = new Customer(...); directly.
This way you will not have to manually write anything in context->cookie;