organizationDefaultValue($entity, $access); } /** * @param $entity * @throws \ReflectionException */ private function organizationDefaultValue($entity, Access $access) { $reflection = new \ReflectionClass($entity::class); $organizationFaultValue = $reflection->getAttributes(OrganizationDefaultValue::class)[0] ?? null; $fieldName = $organizationFaultValue?->getArguments()['fieldName'] ?? null; if($fieldName){ $entity->{sprintf('set%s', ucfirst($fieldName))}(...[$access->getOrganization()]); } } }