zendframework / zend-db

Db component from Zend Framework
BSD 3-Clause "New" or "Revised" License
101 stars 122 forks source link

Hotfix #376: Accessing constraint metadata within the Oracle adapter #399

Closed panychek closed 4 years ago

panychek commented 4 years ago

Fixes #376

The OracleMetadata::loadConstraintData method simply does not work:

$metadata = \Zend\Db\Metadata\Source\Factory::createSourceFromAdapter($adapter);
$constraints = $metadata->getConstraints($table, $schema); // always an empty array

The existing test couldn't catch it because there is no real table involved: https://github.com/zendframework/zend-db/blob/4c68f2c33beb76d63a59c5bd5e6c96c9763966d7/test/unit/Metadata/Source/OracleMetadataTest.php#L48-L49

michalbundyra commented 4 years ago

@panychek Thanks for your contribution. We need unit test for that change.

panychek commented 4 years ago

I modified the existing one, so please have a look. BTW, there are no tests for this behavior in either of the adapters.

michalbundyra commented 4 years ago

Thanks, @panychek!