codefog / contao-haste

Haste is a collection of tools and classes to ease working with Contao
http://codefog.pl/extension/haste.html
MIT License
43 stars 24 forks source link

Follow singleton pattern for DcaExtractor #126

Closed bezin closed 6 years ago

bezin commented 6 years ago

Hello there,

while working with Haste I stumbled upon a tiny issue in the ModelData class. It instantiated a new DcaExtractor object rather than getting an instance via getInstance. DcaExtractors constructor is private, hence a fatal error when using this class.

Cheerio

aschempp commented 6 years ago

Is the getInstance() method available in all Contao versions?

Toflar commented 6 years ago

Yes, I have noticed and asked for a change back in 3.4 for performance reasons. See https://github.com/contao/core/issues/7324

bezin commented 6 years ago

It is available since 3.5. Edit: The constructor is protected since 3.5. getInstance() is available since 3.4 as @Toflar mentioned :)