Skip to content

Preference Module – When to Pass in Parent Dependencies

I am currently creating a preference module to add additional functionality to MagentoCatalogModelProduct and in reviewing some of the tutorials, example below, I noted that dependencies weren’t being passed to the parent constructor.

Is this just a careless omission or do the dependencies only needed to be passed to the parent constructor in certain circumstances?

<?php
namespace MyModuleProductPreferenceModel;

class Product extends MagentoCatalogModelProduct
{
    public function getName()
    {
        return "New Nameo";
    }
}