/** * Generates and returns the array (as a PHP source code string) * to collect the MANY_MANY related data from the POST. * @param string $modelClass The model class name. * @return string The source code to collect the MANY_MANY related * data from the POST. */ public function generateGetPostRelatedData($modelClass, $indent = 1) { $result = array(); $relations = $this->getRelations($modelClass); foreach ($relations as $relationData) { $relationName = $relationData[0]; $relationType = $relationData[1]; if ($relationType == GxActiveRecord::MANY_MANY) $result[$relationData[0]] = "php:\$_POST['{$modelClass}']['{$relationName}'] === '' ? null : \$_POST['{$modelClass}']['{$relationName}']"; } return GxCoreHelper::ArrayToPhpSource($result, $indent); }