public function processAssoc(NodeInterface $node, array $mapping, array $assoc)
    {
        $isNull = function ($item) {
            return null === $item;
        };

        $isNotNull = function ($item) {
            return null !== $item;
        };

        $keys = array_keys($assoc);
        $values = array_values(array_filter($assoc, $isNotNull));
        $nulls = array_keys(array_filter($assoc, $isNull));

        if (empty($keys)) {
            $this->removeAssoc($node, $mapping);
        } else {
            $node->setProperty($mapping['assoc'], $keys, PropertyType::STRING);
            $node->setProperty($mapping['assocNulls'], $nulls, PropertyType::STRING);
        }

        return $values;
    }
public function processAssoc(NodeInterface $node, array $mapping, array $assoc)
    {
        $isNull = function ($item) {
            return null === $item;
        };

        $isNotNull = function ($item) {
            return null !== $item;
        };

        $keys = array_keys($assoc);
        $values = array_values(array_filter($assoc, $isNotNull));
        $nulls = array_keys(array_filter($assoc, $isNull));

        if (empty($keys)) {
            $this->removeAssoc($node, $mapping);
        } else {
            $node->setProperty($mapping['assoc'], $keys, PropertyType::STRING);
            $node->setProperty($mapping['assocNulls'], $nulls, PropertyType::STRING);
        }

        return $values;
    }
public function processAssoc ( NodeInterface $ node , array $ mapping , array $ assoc ) { $ isNull = function ( $ item ) { return null === $ item ; } ; $ isNotNull = function ( $ item ) { return null !== $ item ; } ; $ keys = array_keys ( $ assoc ) ; $ values = array_values ( array_filter ( $ assoc , $ isNotNull ) ) ; $ nulls = array_keys ( array_filter ( $ assoc , $ isNull ) ) ; if ( empty ( $ keys ) ) { $ this -> removeAssoc ( $ node , $ mapping ) ; } else { $ node -> setProperty ( $ mapping [ 'assoc' ] , $ keys , PropertyType :: STRING ) ; $ node -> setProperty ( $ mapping [ 'assocNulls' ] , $ nulls , PropertyType :: STRING ) ; } return $ values ; }
Process null values in an associative array so that they can be stored in phpcr.

Stores keys and null fields in the node and returns the processed values

@param NodeInterface $node    the node where to store the assoc array
@param array         $mapping the field's mapping
@param array         $assoc   the associative array

@return array
Process null values in an associative array so that they can be stored in phpcr .