/**
  * Adds a location to provided content.
  * Prefer using SQLIContent::addLocation() instead of calling this method directly
  * @param SQLILocation $location
  * @param SQLIContent $content
  * @internal
  */
 public function addLocationToContent(SQLILocation $location, SQLIContent $content)
 {
     $nodeID = $content->attribute('main_node_id');
     if (!$nodeID) {
         // No main node ID, object has not been published at least once
         throw new SQLIContentException(__METHOD__ . ' => Cannot directly add a location to a not-yet-published content. Content Object ID = ' . $content->attribute('id') . '. Try to use SQLIContent::addLocation()');
     }
     $objectID = $content->attribute('id');
     $locationNodeID = $location->getNodeID();
     // Check first if content has already an assigned node in provided location
     $assignedNodes = $content->assignedNodes(false);
     for ($i = 0, $iMax = count($assignedNodes); $i < $iMax; ++$i) {
         if ($locationNodeID == $assignedNodes[$i]['parent_node_id']) {
             eZDebug::writeWarning(__METHOD__ . ' => Content with ObjectID #' . $objectID . ' already has a location as a child of node #' . $locationNodeID);
             return;
         }
     }
     eZDebug::accumulatorStart('sqlicontentpublisher_add_location', 'sqlicontentpublisher', 'Adding a location for object #' . $objectID);
     $selectedNodeIDArray = array($locationNodeID);
     if (eZOperationHandler::operationIsAvailable('content_addlocation')) {
         $operationResult = eZOperationHandler::execute('content', 'addlocation', array('node_id' => $nodeID, 'object_id' => $objectID, 'select_node_id_array' => $selectedNodeIDArray), null, true);
     } else {
         eZContentOperationCollection::addAssignment($nodeID, $objectID, $selectedNodeIDArray);
     }
     $content->refreshLocations();
     eZDebug::accumulatorStop('sqlicontentpublisher_add_location');
 }