Design Patterns PHP - Abstract Factory Java

1) What has changed ?

We must added different implementations of ProductA and ProductB

ProductA:

interface ProductA
{

}

class ProductA1 implements ProductA
{

}

class ProductA2 implements ProductA
{

}



ProductB:

interface ProductB
{

}

class ProductB1 implements ProductB
{

}

class ProductB2 implements ProductB
{

}




So we created interfaces "ProductA" and "ProductB" and two implementations of this types.

According to our requirements we want to create either (together ProductA1 and ProductB1) or (together ProductA2 and ProductB2).

In application we still directly create objects


$productA = new ProductA1();

$productB = new ProductB1();




2) What are disadvantages of our solution ?

If we want in application changing creating objects(2) instead of objects(1) we need to do this manually, let's imagine that places when we create this places are plenty
The solution unacceptable

3) What we can improve ?

We can pass to application special parameter according to which we would create instances relevant classes.