corcel / acf

Advanced Custom Fields (ACF) plugin for Corcel
126 stars 98 forks source link

Bugfix for Image fields when using a non-default connection #71

Open nadinengland opened 5 years ago

nadinengland commented 5 years ago

Image fields only used the default connection when loading rather than using parent Post's connection. I noticed that for all fields there is a postMeta that is set to use the same connection as the parent, so the Image field has been changed to use this instead of using the base PostMeta macro methods.

In order to test this I've had to create a new connection in tests/config/bootstrap.php, and also make a fixture class in tests/CorcelIntegrationTest.php. I would have put it in its own file, but the tests themselves aren't loaded via PSR-4. I thought it would be simpler to add the class inline for the time being, as its a wider change to load them all this way.