Originally: There are 2 blocks like this:
namespace Vendor\Module_1\Block;
class ParentBlock{}
class ChildBlock extends ParentBlock {}
Now, I need to rewrite ParentBlock using di.xml:
<preference for="Vendor\Module_1\Block\ParentBlock" type="Vendor\Module_2\Block\ParentBlock" />
namespace Vendor\Module_2\Block;
class ParentBlock extends \Vendor\Module_1\Block\ParentBlock {}
How can I make \Vendor\Module_1\Block\ChildBlock extend from \Vendor\Module_2\Block\ParentBlock?
If there is any more information needed, please tell me.
Thanks in advanced.
===
Updated following answers from @Raphael at Digital Pianism.
Thanks for your explanation. And I thought as you said too, but in my case, it doesn't work.
I have to create a new preference for Module_1\ChildBlock. Then I have to create new Module_2\ChildBlock like this:
namespace Vendor\Module_2\Block;
class ChildBlock extends \Vendor\Module_2\Block\ParentBlock {}
Finally, I have to copy all methods from Module_1\ChildBlock to this one.
This is so crazy!!! I don't know what's wrong, as well as how to fix this problem.