try { $publisher->save(); } catch (Exception $e) { echo $e->getMessage(); } $publisherID = $publisher->primaryKey; } ################################################################# // PUBLISHER / PLATFORM // Query to see if the Publisher / Platform already exists, if so, get the ID ################################################################# //check it against the previous row - no need to do another lookup if we've already figured out the publisherplatformID if (!isset($publisherPlatformID) || $publisherName != $holdPublisher || $platformName != $holdPlatform) { //get the publisher platform object $publisherPlatformTestObj = new PublisherPlatform(); $publisherPlatformObj = $publisherPlatformTestObj->getPublisherPlatform($publisherID, $platformID); if (is_object($publisherPlatformObj)) { $publisherPlatformID = $publisherPlatformObj->publisherPlatformID; } } //If it does not already exist, insert it and get the new ID if (!$publisherPlatformID && $publisherID && $platformID) { $publisherPlatform = new PublisherPlatform(); $publisherPlatform->publisherPlatformID = ''; $publisherPlatform->publisherID = $publisherID; $publisherPlatform->platformID = $platformID; $publisherPlatform->organizationID = ''; $publisherPlatform->reportDropDownInd = '0'; $publisherPlatform->reportDisplayName = $publisherName; try { $publisherPlatform->save();