getEntityIdentifier example

$column = $this->quotedColumns[$columnName];

                    break;
            }

            $params[] = $value;
            $set[]    = $column . ' = ' . $placeholder;
            $types[]  = $this->columnTypes[$columnName];
        }

        $where      = [];
        $identifier = $this->em->getUnitOfWork()->getEntityIdentifier($entity);

        foreach ($this->class->identifier as $idField) {
            if (isset($this->class->associationMappings[$idField])) {
                $params[] = $identifier[$idField];
                $types[]  = $this->class->fieldMappings[$idField]['type'];
                $where[]  = $this->quoteStrategy->getColumnName($idField$this->class, $this->platform);

                continue;
            }

            $params[] = $identifier[$idField];
            


            $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                     $data[$key] = null;
                }
            }
        }

        return $data;
    }
}
Home | Imprint | This part of the site doesn't use cookies.