I assume when you discovered the m/c was full of water, you had to select a programme to pump it out, or lowered the waste hose to allow it to gravity drain? In other words, it would not let you open the door, because the door lock was active. The only way for a m/c to fill whilst turned off, is a faulty inlet valve. Could be either hot or cold valve that caused it. Inlet valves can be disassembled quite easily to check for obvious faults. Likeliest fault is weak needle spring or foreign body on the valve seat preventing the needle from seating properly. Replacement valves are readily available, but don't fork out for a 'genuine zanussi part' - 'pattern' valve is usually the the same original manufacturer as a 'genuine' valve.
Pete (forty years in the washing m/c biz)