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

dcg compatibility for check instance of contao datacontainer #94

Closed baumannsven closed 7 years ago

baumannsven commented 7 years ago

Dc General don´t use root namespace. By action delete the check instance of \DataContainer failed.

aschempp commented 7 years ago

Sound legit, but I think we don't need both checks? As \DataContainer extends from Contao\DataContainer, checking only the later should be sufficient?

qzminski commented 7 years ago

As far as I remember it won't work. I think I had a case where \DataContainer !== \Contao\DataContainer but that should be tested.

Toflar commented 7 years ago

LGTM 👍

baumannsven commented 7 years ago

I have a alternative fix for this problem. Before test object is a instance of \DataContainer, test if class_exists('\DataContainer'). Then works too.

What do you mean. If this better for you, i costumize this pull request.

zonky2 commented 7 years ago

It´s possible to check the solution of @baumannsven ? we have a fatal error at MetaModel...

discordier commented 7 years ago

@qzminski The only case where this happens is when someone is aliasing an own implementation to \DataContainer However this is no problem when checking via instanceof, as the inheritance must always be kept.

So the proposed check by @baumannsven is correct, as it is checking both implementations (which by contract) both will be ABI compatible.