protected function proceedChangeSetsDependsOnAndNeededBy(array $changeSet)
    {
        $keysToUnset = array('id', 'number', 'revision', 'ref');

        // Take care of neededBy
        if (isset($changeSet['neededBy']) === true) {
            foreach ($changeSet['neededBy'] as $neededBy) {
                $neededByData = array(
                    'changeset' => $changeSet['id'],
                    'identifier' => $neededBy['id'],
                    'number' => $neededBy['number'],
                    'revision' => $neededBy['revision'],
                    'ref' => $neededBy['ref'],
                    'status' => Database::TMP_DEPENDS_NEEDED_STATUS_NEEDEDBY
                );
                $this->getDatabase()->insertRecord(Database::TABLE_TMP_DEPENDS_NEEDED, $neededByData);

                $neededBy = $this->unsetKeys($neededBy, $keysToUnset);
                $this->checkIfAllValuesWereProceeded($neededBy, 'neededBy');
            }

            unset($neededBy);
        }

        // Take care of dependsOn
        if (isset($changeSet['dependsOn']) === true) {

            $keysToUnset[] = 'isCurrentPatchSet';

            foreach ($changeSet['dependsOn'] as $dependsOn) {
                $dependsOnData = array(
                    'changeset' => $changeSet['id'],
                    'identifier' => $dependsOn['id'],
                    'number' => $dependsOn['number'],
                    'revision' => $dependsOn['revision'],
                    'ref' => $dependsOn['ref'],
                    'is_current_patchset' => (int) $dependsOn['isCurrentPatchSet'],
                    'status' => Database::TMP_DEPENDS_NEEDED_STATUS_DEPENDSON
                );
                $this->getDatabase()->insertRecord(Database::TABLE_TMP_DEPENDS_NEEDED, $dependsOnData);

                $dependsOn = $this->unsetKeys($dependsOn, $keysToUnset);
                $this->checkIfAllValuesWereProceeded($dependsOn, 'dependsOn');
            }

            unset($dependsOn);
        }
    }
protected function proceedChangeSetsDependsOnAndNeededBy(array $changeSet)
    {
        $keysToUnset = array('id', 'number', 'revision', 'ref');

        // Take care of neededBy
        if (isset($changeSet['neededBy']) === true) {
            foreach ($changeSet['neededBy'] as $neededBy) {
                $neededByData = array(
                    'changeset' => $changeSet['id'],
                    'identifier' => $neededBy['id'],
                    'number' => $neededBy['number'],
                    'revision' => $neededBy['revision'],
                    'ref' => $neededBy['ref'],
                    'status' => Database::TMP_DEPENDS_NEEDED_STATUS_NEEDEDBY
                );
                $this->getDatabase()->insertRecord(Database::TABLE_TMP_DEPENDS_NEEDED, $neededByData);

                $neededBy = $this->unsetKeys($neededBy, $keysToUnset);
                $this->checkIfAllValuesWereProceeded($neededBy, 'neededBy');
            }

            unset($neededBy);
        }

        // Take care of dependsOn
        if (isset($changeSet['dependsOn']) === true) {

            $keysToUnset[] = 'isCurrentPatchSet';

            foreach ($changeSet['dependsOn'] as $dependsOn) {
                $dependsOnData = array(
                    'changeset' => $changeSet['id'],
                    'identifier' => $dependsOn['id'],
                    'number' => $dependsOn['number'],
                    'revision' => $dependsOn['revision'],
                    'ref' => $dependsOn['ref'],
                    'is_current_patchset' => (int) $dependsOn['isCurrentPatchSet'],
                    'status' => Database::TMP_DEPENDS_NEEDED_STATUS_DEPENDSON
                );
                $this->getDatabase()->insertRecord(Database::TABLE_TMP_DEPENDS_NEEDED, $dependsOnData);

                $dependsOn = $this->unsetKeys($dependsOn, $keysToUnset);
                $this->checkIfAllValuesWereProceeded($dependsOn, 'dependsOn');
            }

            unset($dependsOn);
        }
    }
protected function proceedChangeSetsDependsOnAndNeededBy ( array $ changeSet ) { $ keysToUnset = array ( 'id' , 'number' , 'revision' , 'ref' ) ; // Take care of neededBy if ( isset ( $ changeSet [ 'neededBy' ] ) === true ) { foreach ( $ changeSet [ 'neededBy' ] as $ neededBy ) { $ neededByData = array ( 'changeset' => $ changeSet [ 'id' ] , 'identifier' => $ neededBy [ 'id' ] , 'number' => $ neededBy [ 'number' ] , 'revision' => $ neededBy [ 'revision' ] , 'ref' => $ neededBy [ 'ref' ] , 'status' => Database :: TMP_DEPENDS_NEEDED_STATUS_NEEDEDBY ) ; $ this -> getDatabase ( ) -> insertRecord ( Database :: TABLE_TMP_DEPENDS_NEEDED , $ neededByData ) ; $ neededBy = $ this -> unsetKeys ( $ neededBy , $ keysToUnset ) ; $ this -> checkIfAllValuesWereProceeded ( $ neededBy , 'neededBy' ) ; } unset ( $ neededBy ) ; } // Take care of dependsOn if ( isset ( $ changeSet [ 'dependsOn' ] ) === true ) { $ keysToUnset [ ] = 'isCurrentPatchSet' ; foreach ( $ changeSet [ 'dependsOn' ] as $ dependsOn ) { $ dependsOnData = array ( 'changeset' => $ changeSet [ 'id' ] , 'identifier' => $ dependsOn [ 'id' ] , 'number' => $ dependsOn [ 'number' ] , 'revision' => $ dependsOn [ 'revision' ] , 'ref' => $ dependsOn [ 'ref' ] , 'is_current_patchset' => ( int ) $ dependsOn [ 'isCurrentPatchSet' ] , 'status' => Database :: TMP_DEPENDS_NEEDED_STATUS_DEPENDSON ) ; $ this -> getDatabase ( ) -> insertRecord ( Database :: TABLE_TMP_DEPENDS_NEEDED , $ dependsOnData ) ; $ dependsOn = $ this -> unsetKeys ( $ dependsOn , $ keysToUnset ) ; $ this -> checkIfAllValuesWereProceeded ( $ dependsOn , 'dependsOn' ) ; } unset ( $ dependsOn ) ; } }
Proceed "dependsOn" and "neededBy" for a single changeset.
This is a little bit tricky, because there can be a dependsOn
reference to a changeset which is not imported yet.

Solution: A temp table
We insert all "dependsOn" and "neededBy" records into one temp table.
After we finished all changesets for this project, we got all changesets
for our "dependsOn" and "neededBy" mapping, too.
Then we update the changesets table :)

"dependsOn" and "neededBy" ... WHAT?!
If you don`t know what this is, have a look at https://review.typo3.org/#/c/17997/ into the dependency section

@see $this->proceedChangeSetsDependsOnRelation()

@param array $changeSet
@return void
Proceed dependsOn and neededBy for a single changeset . This is a little bit tricky because there can be a dependsOn reference to a changeset which is not imported yet .