Skip to content

Commit

Permalink
Merge pull request #8 from formapro/fix-builder-hook
Browse files Browse the repository at this point in the history
Fix Object Builder Hook
  • Loading branch information
ASKozienko authored Oct 4, 2017
2 parents 730e2b5 + 739a581 commit 244edd2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ObjectBuilderHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class ObjectBuilderHook
{
/**
* @var PvmClassMap
* @var array
*/
private $classMap;

Expand All @@ -15,14 +15,14 @@ class ObjectBuilderHook
*/
public function __construct(array $classMap = [])
{
$this->classMap = new PvmClassMap($classMap);
$this->classMap = (new PvmClassMap($classMap))->get();
}

public function register()
{
register_global_hook('get_object_class', function(array $values) {
if (isset($values['schema'])) {
if (false == array_key_exists($values['schema'], $this->classMap->get())) {
if (false == array_key_exists($values['schema'], $this->classMap)) {
throw new \LogicException(sprintf('An object has class set "%s" but there is no class for it', $values['class']));
}

Expand Down

0 comments on commit 244edd2

Please sign in to comment.