@@ 1072-1096 (lines=25) @@ | ||
1069 | * |
|
1070 | * @return array |
|
1071 | */ |
|
1072 | private function getMethodCallbacks(\ReflectionMethod $method) |
|
1073 | { |
|
1074 | $annotations = $this->getMethodAnnotations($method); |
|
1075 | $events = [ |
|
1076 | Events::prePersist => Annotation\PrePersist::class, |
|
1077 | Events::postPersist => Annotation\PostPersist::class, |
|
1078 | Events::preUpdate => Annotation\PreUpdate::class, |
|
1079 | Events::postUpdate => Annotation\PostUpdate::class, |
|
1080 | Events::preRemove => Annotation\PreRemove::class, |
|
1081 | Events::postRemove => Annotation\PostRemove::class, |
|
1082 | Events::postLoad => Annotation\PostLoad::class, |
|
1083 | Events::preFlush => Annotation\PreFlush::class, |
|
1084 | ]; |
|
1085 | ||
1086 | // Check for callbacks |
|
1087 | $callbacks = []; |
|
1088 | ||
1089 | foreach ($events as $eventName => $annotationClassName) { |
|
1090 | if (isset($annotations[$annotationClassName]) || $method->getName() === $eventName) { |
|
1091 | $callbacks[] = $eventName; |
|
1092 | } |
|
1093 | } |
|
1094 | ||
1095 | return $callbacks; |
|
1096 | } |
|
1097 | ||
1098 | /** |
|
1099 | * Attempts to resolve the fetch mode. |
@@ 1276-1300 (lines=25) @@ | ||
1273 | * |
|
1274 | * @return array |
|
1275 | */ |
|
1276 | private function getMethodCallbacks(\ReflectionMethod $method) : array |
|
1277 | { |
|
1278 | $annotations = $this->getMethodAnnotations($method); |
|
1279 | $events = [ |
|
1280 | Events::prePersist => Annotation\PrePersist::class, |
|
1281 | Events::postPersist => Annotation\PostPersist::class, |
|
1282 | Events::preUpdate => Annotation\PreUpdate::class, |
|
1283 | Events::postUpdate => Annotation\PostUpdate::class, |
|
1284 | Events::preRemove => Annotation\PreRemove::class, |
|
1285 | Events::postRemove => Annotation\PostRemove::class, |
|
1286 | Events::postLoad => Annotation\PostLoad::class, |
|
1287 | Events::preFlush => Annotation\PreFlush::class, |
|
1288 | ]; |
|
1289 | ||
1290 | // Check for callbacks |
|
1291 | $callbacks = []; |
|
1292 | ||
1293 | foreach ($events as $eventName => $annotationClassName) { |
|
1294 | if (isset($annotations[$annotationClassName]) || $method->getName() === $eventName) { |
|
1295 | $callbacks[] = $eventName; |
|
1296 | } |
|
1297 | } |
|
1298 | ||
1299 | return $callbacks; |
|
1300 | } |
|
1301 | ||
1302 | /** |
|
1303 | * @param \ReflectionClass $reflectionClass |