protected function getExpectedIdentifiers($context = null)
    {
        if ($context === null) {
            throw new Exception\RuntimeException(
                'Expected context to be an array but is null'
            );
        }

        $className = $this->objectRepository->getClassName();

        if ($context instanceof $className) {
            return $this->objectManager
                        ->getClassMetadata($this->objectRepository->getClassName())
                        ->getIdentifierValues($context);
        }

        $result = [];
        foreach ($this->getIdentifiers() as $identifierField) {
            if (! array_key_exists($identifierField, $context)) {
                throw new Exception\RuntimeException(\sprintf('Expected context to contain %s', $identifierField));
            }

            $result[$identifierField] = $context[$identifierField];
        }
        return $result;
    }
protected function getExpectedIdentifiers($context = null)
    {
        if ($context === null) {
            throw new Exception\RuntimeException(
                'Expected context to be an array but is null'
            );
        }

        $className = $this->objectRepository->getClassName();

        if ($context instanceof $className) {
            return $this->objectManager
                        ->getClassMetadata($this->objectRepository->getClassName())
                        ->getIdentifierValues($context);
        }

        $result = [];
        foreach ($this->getIdentifiers() as $identifierField) {
            if (! array_key_exists($identifierField, $context)) {
                throw new Exception\RuntimeException(\sprintf('Expected context to contain %s', $identifierField));
            }

            $result[$identifierField] = $context[$identifierField];
        }
        return $result;
    }
protected function getExpectedIdentifiers ( $ context = null ) { if ( $ context === null ) { throw new Exception \ RuntimeException ( 'Expected context to be an array but is null' ) ; } $ className = $ this -> objectRepository -> getClassName ( ) ; if ( $ context instanceof $ className ) { return $ this -> objectManager -> getClassMetadata ( $ this -> objectRepository -> getClassName ( ) ) -> getIdentifierValues ( $ context ) ; } $ result = [ ] ; foreach ( $ this -> getIdentifiers ( ) as $ identifierField ) { if ( ! array_key_exists ( $ identifierField , $ context ) ) { throw new Exception \ RuntimeException ( \ sprintf ( 'Expected context to contain %s' , $ identifierField ) ) ; } $ result [ $ identifierField ] = $ context [ $ identifierField ] ; } return $ result ; }
Gets the identifiers from the context.

@param  array|object $context
@return array
@throws Exception\RuntimeException
Gets the identifiers from the context .