Inflector example

if ($entity instanceof Proxy) {
            $entity->__load();
            $className = get_parent_class($entity);
        } else {
            $className = \get_class($entity);
        }
        if (!\is_string($className)) {
            throw new RuntimeException('Could not get class name');
        }
        $metadata = $this->getClassMetadata($className);
        $data = [];
        $inflector = new Inflector(new NoopWordInflector()new NoopWordInflector());

        foreach ($metadata->fieldMappings as $field => $mapping) {
            if (!($metadata->reflFields[$field] instanceof ReflectionProperty)) {
                throw new InvalidArgumentException(sprintf('Expected an instance of %s', ReflectionProperty::class));
            }

            $data[$field] = $metadata->reflFields[$field]->getValue($entity);
        }

        foreach ($metadata->associationMappings as $field => $mapping) {
            if (!($metadata->reflFields[$field] instanceof ReflectionProperty)) {
                
Home | Imprint | This part of the site doesn't use cookies.