Skip to content

Commit 1c5c9ed

Browse files
Fixes the issue
1 parent 2ba571b commit 1c5c9ed

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/Vivait/StringGeneratorBundle/EventListener/GeneratorListener.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,28 +75,29 @@ public function prePersist(LifecycleEventArgs $args)
7575
break;
7676
}
7777

78-
$string = $this->generateString($property->name, $annotation, $object);
78+
$string = $this->generateString($property->name, $annotation, $entity);
7979
$property->setValue($entity, $string);
8080
}
8181
}
8282
}
8383
}
8484

8585
/**
86-
* @param $property
86+
* @param string $property
8787
* @param GeneratorAnnotation $annotation
88-
* @param \ReflectionObject $object
88+
* @param object $entity
89+
*
8990
* @return string
9091
*/
91-
private function generateString($property, GeneratorAnnotation $annotation, $object)
92+
private function generateString($property, GeneratorAnnotation $annotation, $entity)
9293
{
9394
/** @var GeneratorInterface|ConfigurableGeneratorInterface $generator */
9495
$generator = $this->getRegistry()->get($annotation->generator);
9596

9697
$generator->setLength($annotation->length);
9798

9899
if(!empty($annotation->callbacks)){
99-
$this->performCallbacks($generator, $annotation, $object);
100+
$this->performCallbacks($generator, $annotation, $entity);
100101
}
101102

102103
if($generator instanceof ConfigurableGeneratorInterface){
@@ -110,7 +111,7 @@ private function generateString($property, GeneratorAnnotation $annotation, $obj
110111
}
111112

112113
if ($this->repo->findOneBy([$property => $str])) {
113-
return $this->generateString($property, $annotation, $object);
114+
return $this->generateString($property, $annotation, $entity);
114115
} else {
115116
return $str;
116117
}
@@ -135,7 +136,7 @@ public function configureGenerator(ConfigurableGeneratorInterface $generator, $o
135136
/**
136137
* @param GeneratorInterface $generator
137138
* @param GeneratorAnnotation $annotation
138-
* @param \ReflectionObject $object
139+
* @param object $object
139140
*/
140141
public function performCallbacks(GeneratorInterface $generator, GeneratorAnnotation $annotation, $object)
141142
{

0 commit comments

Comments
 (0)