This PVC lateral was cut by a landscaper when he removed a stump, that is the reason the hole is so large.
Cut out the damaged section of PVC pipe .
If there is residual water in the PVC pipe lateral, allow it to drain fully before you attempt gluing.
Here I am using the bell end of the PVC pipe to couple the new PVC pipe to the damaged lateral. Common fittings used for these repairs: Bell end, Coupling, Slip Fix, Compression Coupling or a Tee (for connecting a swing joint for adding or replacing a sprinkler head).
Now that one end of the new PVC pipe is glued, cut the opposite end of the pipe so that they can line up with each other, but not quite touching. There should be a very small gap to accommodate the small ridge at the bottom of the new coupling that will be installed next.
When gluing this fitting together you will have to bend the PVC pipe so that the fittings can be forced together. If you do not have enough space to bend the PVC pipes, you may have to use a slip fix in conjunction with the coupling.
If this is a lateral, you may not need primer as long as your glue is rated to be used without primer.
Hold the PVC pipe and fitting together until the glue sets firm.
This is what the sprinkler PVC pipe repair looks like when complete.