/** * Short description of method singleton * * @access public * @author Jerome Bogaerts, <*****@*****.**> * @return core_kernel_classes_Resource */ public static function singleton() { $returnValue = null; if (core_kernel_persistence_smoothsql_Property::$instance == null) { core_kernel_persistence_smoothsql_Property::$instance = new core_kernel_persistence_smoothsql_Property(); } $returnValue = core_kernel_persistence_smoothsql_Property::$instance; return $returnValue; }
/** * Short description of method setLgDependent * * @access public * @author Jerome Bogaerts, <*****@*****.**> * @param Resource resource * @param boolean isLgDependent * @return void */ public function setLgDependent(\core_kernel_classes_Resource $resource, $isLgDependent) { // First, do the same as in smooth mode. \core_kernel_persistence_smoothsql_Property::singleton()->setLgDependent($resource, $isLgDependent); // Second, we alter the relevant table(s) if needed. // For all the classes that have the resource as domain, // we have to alter the correspondent tables. $referencer = ResourceReferencer::singleton(); $dbWrapper = \core_kernel_classes_DbWrapper::singleton(); $propertyDescription = HardapiUtils::propertyDescriptor($resource); $wasMulti = $propertyDescription['isMultiple']; $wasLgDependent = $propertyDescription['isLgDependent']; // @TODO $batchSize's value is arbitrary. $batchSize = 100; // Transfer data $batchSize by $batchSize. if ($wasLgDependent != $isLgDependent) { try { // The multiplicity is then changing. // However, if the property was not 'language dependent' but 'multiple' // it is already stored as it should. if ($isLgDependent == true && $wasMulti == false && $wasLgDependent == false) { // We go from single to multiple. HardapiUtils::scalarToMultiple($resource, $batchSize); } else { if ($isLgDependent == false && ($wasMulti == true || $wasLgDependent == true)) { // We go from multiple to single. HardapiUtils::multipleToScalar($resource, $batchSize); } } } catch (HardapiException $e) { throw new Exception($e->getMessage()); } } }