tableize example

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)) {
                throw new InvalidArgumentException(sprintf('Expected an instance of %s', ReflectionProperty::class));
            }

            $key = $inflector->tableize($field);
            if ($mapping['isCascadeDetach']) {
                $data[$key] = $metadata->reflFields[$field]->getValue($entity);
                if ($data[$key] !== null) {
                    $data[$key] = $this->serializeEntity($data[$key]);
                }
            } elseif ($mapping['isOwningSide'] && $mapping['type'] & ClassMetadata::TO_ONE) {
                $association = $metadata->reflFields[$field]->getValue($entity);
                if (\is_object($association) && $this->getUnitOfWork()->isInIdentityMap($association)) {
                    $data[$key] = $this->getUnitOfWork()->getEntityIdentifier($association);
                } else {
                    // In some case the relationship may not exist, but we want to know about it
Home | Imprint | This part of the site doesn't use cookies.