Traits: “Horizontal” Reuse

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:07
    OK team, we need a new ship class, a bounty hunter ship.
  • 0:13
    Start simple, in the Model directory add a New Class,
  • 0:17
  • 0:19
    Once again, PhpStorm already added the correct namespace for us.
  • 0:25
    Like every other ship, extend AbstractShip.
  • 0:29
  • 0:30
    But we do not need a use statement for this.
  • 0:34
    That class lives in the same namespace as us.
  • 0:38
    Just like with an interface, when you extend an abstract class,
  • 0:41
    you usually need to implement some methods.
Loading ...