Ejemplo n.º 1
0
 public static function firstParamIsParent(ModelConfig $modelConfig, $returnParentIdValue = false)
 {
     if ($modelConfig->getModelParents() || $modelConfig->parent) {
         $parentIdProperties = AdminHelper::objectToArray($modelConfig->getModelParents());
         if (!$parentIdProperties) {
             $parentIdProperties = array($modelConfig->parent->property);
         }
         if (!empty($_GET)) {
             foreach ($_GET as $parentIdProperty => $id) {
                 if (in_array($parentIdProperty, $parentIdProperties) && is_numeric($id)) {
                     if ($returnParentIdValue) {
                         return $id;
                     }
                     return $parentIdProperty;
                 }
                 // Break after first iteration because first $_GET must be the parent
                 break;
             }
         }
     }
     return false;
 }