/sgl/includes/model/generated/PaisGen.class.php
PHP | 1771 lines | 907 code | 263 blank | 601 comment | 149 complexity | fc205634439df00413d5fa32690ba48a MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0
Large files files are truncated, but you can click here to view the full file
- <?php
- /**
- * The abstract PaisGen class defined here is
- * code-generated and contains all the basic CRUD-type functionality as well as
- * basic methods to handle relationships and index-based loading.
- *
- * To use, you should use the Pais subclass which
- * extends this PaisGen class.
- *
- * Because subsequent re-code generations will overwrite any changes to this
- * file, you should leave this file unaltered to prevent yourself from losing
- * any information or code changes. All customizations should be done by
- * overriding existing or implementing new methods, properties and variables
- * in the Pais class.
- *
- * @package My QCubed Application
- * @subpackage GeneratedDataObjects
- * @property-read integer $IdPAIS the value for intIdPAIS (Read-Only PK)
- * @property string $Nombre the value for strNombre
- * @property-read Importacion $_ImportacionAsPAISOrigen the value for the private _objImportacionAsPAISOrigen (Read-Only) if set due to an expansion on the IMPORTACION.PAIS_Origen reverse relationship
- * @property-read Importacion[] $_ImportacionAsPAISOrigenArray the value for the private _objImportacionAsPAISOrigenArray (Read-Only) if set due to an ExpandAsArray on the IMPORTACION.PAIS_Origen reverse relationship
- * @property-read Importacion $_ImportacionAsPAISDestino the value for the private _objImportacionAsPAISDestino (Read-Only) if set due to an expansion on the IMPORTACION.PAIS_Destino reverse relationship
- * @property-read Importacion[] $_ImportacionAsPAISDestinoArray the value for the private _objImportacionAsPAISDestinoArray (Read-Only) if set due to an ExpandAsArray on the IMPORTACION.PAIS_Destino reverse relationship
- * @property-read Proveedor $_ProveedorAsPAISIdPAIS the value for the private _objProveedorAsPAISIdPAIS (Read-Only) if set due to an expansion on the PROVEEDOR.PAIS_idPAIS reverse relationship
- * @property-read Proveedor[] $_ProveedorAsPAISIdPAISArray the value for the private _objProveedorAsPAISIdPAISArray (Read-Only) if set due to an ExpandAsArray on the PROVEEDOR.PAIS_idPAIS reverse relationship
- * @property-read Transporte $_TransporteAsPAISIdPAIS the value for the private _objTransporteAsPAISIdPAIS (Read-Only) if set due to an expansion on the TRANSPORTE.PAIS_idPAIS reverse relationship
- * @property-read Transporte[] $_TransporteAsPAISIdPAISArray the value for the private _objTransporteAsPAISIdPAISArray (Read-Only) if set due to an ExpandAsArray on the TRANSPORTE.PAIS_idPAIS reverse relationship
- * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
- */
- class PaisGen extends QBaseClass implements IteratorAggregate {
- ///////////////////////////////////////////////////////////////////////
- // PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
- ///////////////////////////////////////////////////////////////////////
-
- /**
- * Protected member variable that maps to the database PK Identity column PAIS.idPAIS
- * @var integer intIdPAIS
- */
- protected $intIdPAIS;
- const IdPAISDefault = null;
- /**
- * Protected member variable that maps to the database column PAIS.nombre
- * @var string strNombre
- */
- protected $strNombre;
- const NombreMaxLength = 45;
- const NombreDefault = null;
- /**
- * Private member variable that stores a reference to a single ImportacionAsPAISOrigen object
- * (of type Importacion), if this Pais object was restored with
- * an expansion on the IMPORTACION association table.
- * @var Importacion _objImportacionAsPAISOrigen;
- */
- private $_objImportacionAsPAISOrigen;
- /**
- * Private member variable that stores a reference to an array of ImportacionAsPAISOrigen objects
- * (of type Importacion[]), if this Pais object was restored with
- * an ExpandAsArray on the IMPORTACION association table.
- * @var Importacion[] _objImportacionAsPAISOrigenArray;
- */
- private $_objImportacionAsPAISOrigenArray = array();
- /**
- * Private member variable that stores a reference to a single ImportacionAsPAISDestino object
- * (of type Importacion), if this Pais object was restored with
- * an expansion on the IMPORTACION association table.
- * @var Importacion _objImportacionAsPAISDestino;
- */
- private $_objImportacionAsPAISDestino;
- /**
- * Private member variable that stores a reference to an array of ImportacionAsPAISDestino objects
- * (of type Importacion[]), if this Pais object was restored with
- * an ExpandAsArray on the IMPORTACION association table.
- * @var Importacion[] _objImportacionAsPAISDestinoArray;
- */
- private $_objImportacionAsPAISDestinoArray = array();
- /**
- * Private member variable that stores a reference to a single ProveedorAsPAISIdPAIS object
- * (of type Proveedor), if this Pais object was restored with
- * an expansion on the PROVEEDOR association table.
- * @var Proveedor _objProveedorAsPAISIdPAIS;
- */
- private $_objProveedorAsPAISIdPAIS;
- /**
- * Private member variable that stores a reference to an array of ProveedorAsPAISIdPAIS objects
- * (of type Proveedor[]), if this Pais object was restored with
- * an ExpandAsArray on the PROVEEDOR association table.
- * @var Proveedor[] _objProveedorAsPAISIdPAISArray;
- */
- private $_objProveedorAsPAISIdPAISArray = array();
- /**
- * Private member variable that stores a reference to a single TransporteAsPAISIdPAIS object
- * (of type Transporte), if this Pais object was restored with
- * an expansion on the TRANSPORTE association table.
- * @var Transporte _objTransporteAsPAISIdPAIS;
- */
- private $_objTransporteAsPAISIdPAIS;
- /**
- * Private member variable that stores a reference to an array of TransporteAsPAISIdPAIS objects
- * (of type Transporte[]), if this Pais object was restored with
- * an ExpandAsArray on the TRANSPORTE association table.
- * @var Transporte[] _objTransporteAsPAISIdPAISArray;
- */
- private $_objTransporteAsPAISIdPAISArray = array();
- /**
- * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
- * columns from the run-time database query result for this object). Used by InstantiateDbRow and
- * GetVirtualAttribute.
- * @var string[] $__strVirtualAttributeArray
- */
- protected $__strVirtualAttributeArray = array();
- /**
- * Protected internal member variable that specifies whether or not this object is Restored from the database.
- * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
- * @var bool __blnRestored;
- */
- protected $__blnRestored;
- ///////////////////////////////
- // PROTECTED MEMBER OBJECTS
- ///////////////////////////////
- /**
- * Initialize each property with default values from database definition
- */
- public function Initialize()
- {
- $this->intIdPAIS = Pais::IdPAISDefault;
- $this->strNombre = Pais::NombreDefault;
- }
- ///////////////////////////////
- // CLASS-WIDE LOAD AND COUNT METHODS
- ///////////////////////////////
- /**
- * Static method to retrieve the Database object that owns this class.
- * @return QDatabaseBase reference to the Database object that can query this class
- */
- public static function GetDatabase() {
- return QApplication::$Database[1];
- }
- /**
- * Load a Pais from PK Info
- * @param integer $intIdPAIS
- * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
- * @return Pais
- */
- public static function Load($intIdPAIS, $objOptionalClauses = null) {
- // Use QuerySingle to Perform the Query
- return Pais::QuerySingle(
- QQ::AndCondition(
- QQ::Equal(QQN::Pais()->IdPAIS, $intIdPAIS)
- ),
- $objOptionalClauses
- );
- }
- /**
- * Load all Paises
- * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
- * @return Pais[]
- */
- public static function LoadAll($objOptionalClauses = null) {
- if (func_num_args() > 1) {
- throw new QCallerException("LoadAll must be called with an array of optional clauses as a single argument");
- }
- // Call Pais::QueryArray to perform the LoadAll query
- try {
- return Pais::QueryArray(QQ::All(), $objOptionalClauses);
- } catch (QCallerException $objExc) {
- $objExc->IncrementOffset();
- throw $objExc;
- }
- }
- /**
- * Count all Paises
- * @return int
- */
- public static function CountAll() {
- // Call Pais::QueryCount to perform the CountAll query
- return Pais::QueryCount(QQ::All());
- }
- ///////////////////////////////
- // QCUBED QUERY-RELATED METHODS
- ///////////////////////////////
- /**
- * Internally called method to assist with calling Qcubed Query for this class
- * on load methods.
- * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
- * @param QQCondition $objConditions any conditions on the query, itself
- * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
- * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
- * @param boolean $blnCountOnly only select a rowcount
- * @return string the query statement
- */
- protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- // Create/Build out the QueryBuilder object with Pais-specific SELET and FROM fields
- $objQueryBuilder = new QQueryBuilder($objDatabase, 'PAIS');
- Pais::GetSelectFields($objQueryBuilder);
- $objQueryBuilder->AddFromItem('PAIS');
- // Set "CountOnly" option (if applicable)
- if ($blnCountOnly)
- $objQueryBuilder->SetCountOnlyFlag();
- // Apply Any Conditions
- if ($objConditions)
- try {
- $objConditions->UpdateQueryBuilder($objQueryBuilder);
- } catch (QCallerException $objExc) {
- $objExc->IncrementOffset();
- throw $objExc;
- }
- // Iterate through all the Optional Clauses (if any) and perform accordingly
- if ($objOptionalClauses) {
- if ($objOptionalClauses instanceof QQClause)
- $objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
- else if (is_array($objOptionalClauses))
- foreach ($objOptionalClauses as $objClause)
- $objClause->UpdateQueryBuilder($objQueryBuilder);
- else
- throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
- }
- // Get the SQL Statement
- $strQuery = $objQueryBuilder->GetStatement();
- // Prepare the Statement with the Query Parameters (if applicable)
- if ($mixParameterArray) {
- if (is_array($mixParameterArray)) {
- if (count($mixParameterArray))
- $strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);
- // Ensure that there are no other Unresolved Named Parameters
- if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
- throw new QCallerException('Unresolved named parameters in the query');
- } else
- throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
- }
- // Return the Objects
- return $strQuery;
- }
- /**
- * Static Qcubed Query method to query for a single Pais object.
- * Uses BuildQueryStatment to perform most of the work.
- * @param QQCondition $objConditions any conditions on the query, itself
- * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
- * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
- * @return Pais the queried object
- */
- public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
- // Get the Query Statement
- try {
- $strQuery = Pais::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
- } catch (QCallerException $objExc) {
- $objExc->IncrementOffset();
- throw $objExc;
- }
-
- // Perform the Query, Get the First Row, and Instantiate a new Pais object
- $objDbResult = $objQueryBuilder->Database->Query($strQuery);
-
- // Do we have to expand anything?
- if ($objQueryBuilder->ExpandAsArrayNodes) {
- $objToReturn = array();
- while ($objDbRow = $objDbResult->GetNextRow()) {
- $objItem = Pais::InstantiateDbRow($objDbRow, null, $objQueryBuilder->ExpandAsArrayNodes, $objToReturn, $objQueryBuilder->ColumnAliasArray);
- if ($objItem)
- $objToReturn[] = $objItem;
- }
- if (count($objToReturn)) {
- // Since we only want the object to return, lets return the object and not the array.
- return $objToReturn[0];
- } else {
- return null;
- }
- } else {
- // No expands just return the first row
- $objDbRow = $objDbResult->GetNextRow();
- if(null === $objDbRow)
- return null;
- return Pais::InstantiateDbRow($objDbRow, null, null, null, $objQueryBuilder->ColumnAliasArray);
- }
- }
- /**
- * Static Qcubed Query method to query for an array of Pais objects.
- * Uses BuildQueryStatment to perform most of the work.
- * @param QQCondition $objConditions any conditions on the query, itself
- * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
- * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
- * @return Pais[] the queried objects as an array
- */
- public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
- // Get the Query Statement
- try {
- $strQuery = Pais::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
- } catch (QCallerException $objExc) {
- $objExc->IncrementOffset();
- throw $objExc;
- }
- // Perform the Query and Instantiate the Array Result
- $objDbResult = $objQueryBuilder->Database->Query($strQuery);
- return Pais::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
- }
- /**
- * Static Qcubed Query method to query for a count of Pais objects.
- * Uses BuildQueryStatment to perform most of the work.
- * @param QQCondition $objConditions any conditions on the query, itself
- * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
- * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
- * @return integer the count of queried objects as an integer
- */
- public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
- // Get the Query Statement
- try {
- $strQuery = Pais::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
- } catch (QCallerException $objExc) {
- $objExc->IncrementOffset();
- throw $objExc;
- }
- // Perform the Query and return the row_count
- $objDbResult = $objQueryBuilder->Database->Query($strQuery);
- // Figure out if the query is using GroupBy
- $blnGrouped = false;
- if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
- if ($objClause instanceof QQGroupBy) {
- $blnGrouped = true;
- break;
- }
- }
- if ($blnGrouped)
- // Groups in this query - return the count of Groups (which is the count of all rows)
- return $objDbResult->CountRows();
- else {
- // No Groups - return the sql-calculated count(*) value
- $strDbRow = $objDbResult->FetchRow();
- return QType::Cast($strDbRow[0], QType::Integer);
- }
- }
- public static function QueryArrayCached(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null, $blnForceUpdate = false) {
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- $strQuery = Pais::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
-
- $objCache = new QCache('qquery/pais', $strQuery);
- $cacheData = $objCache->GetData();
-
- if (!$cacheData || $blnForceUpdate) {
- $objDbResult = $objQueryBuilder->Database->Query($strQuery);
- $arrResult = Pais::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
- $objCache->SaveData(serialize($arrResult));
- } else {
- $arrResult = unserialize($cacheData);
- }
-
- return $arrResult;
- }
- /**
- * Updates a QQueryBuilder with the SELECT fields for this Pais
- * @param QQueryBuilder $objBuilder the Query Builder object to update
- * @param string $strPrefix optional prefix to add to the SELECT fields
- */
- public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
- if ($strPrefix) {
- $strTableName = $strPrefix;
- $strAliasPrefix = $strPrefix . '__';
- } else {
- $strTableName = 'PAIS';
- $strAliasPrefix = '';
- }
- $objBuilder->AddSelectItem($strTableName, 'idPAIS', $strAliasPrefix . 'idPAIS');
- $objBuilder->AddSelectItem($strTableName, 'nombre', $strAliasPrefix . 'nombre');
- }
- ///////////////////////////////
- // INSTANTIATION-RELATED METHODS
- ///////////////////////////////
- /**
- * Instantiate a Pais from a Database Row.
- * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
- * is calling this Pais::InstantiateDbRow in order to perform
- * early binding on referenced objects.
- * @param DatabaseRowBase $objDbRow
- * @param string $strAliasPrefix
- * @param string $strExpandAsArrayNodes
- * @param QBaseClass $arrPreviousItem
- * @param string[] $strColumnAliasArray
- * @return Pais
- */
- public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array()) {
- // If blank row, return null
- if (!$objDbRow) {
- return null;
- }
- // See if we're doing an array expansion on the previous item
- $strAlias = $strAliasPrefix . 'idPAIS';
- $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
- if (($strExpandAsArrayNodes) && is_array($arrPreviousItems) && count($arrPreviousItems)) {
- foreach ($arrPreviousItems as $objPreviousItem) {
- if ($objPreviousItem->intIdPAIS == $objDbRow->GetColumn($strAliasName, 'Integer')) {
- // We are. Now, prepare to check for ExpandAsArray clauses
- $blnExpandedViaArray = false;
- if (!$strAliasPrefix)
- $strAliasPrefix = 'PAIS__';
- // Expanding reverse references: ImportacionAsPAISOrigen
- $strAlias = $strAliasPrefix . 'importacionaspaisorigen__TRANSPORTE_idTRANSPORTE';
- $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
- if ((array_key_exists($strAlias, $strExpandAsArrayNodes)) &&
- (!is_null($objDbRow->GetColumn($strAliasName)))) {
- if ($intPreviousChildItemCount = count($objPreviousItem->_objImportacionAsPAISOrigenArray)) {
- $objPreviousChildItems = $objPreviousItem->_objImportacionAsPAISOrigenArray;
- $objChildItem = Importacion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'importacionaspaisorigen__', $strExpandAsArrayNodes, $objPreviousChildItems, $strColumnAliasArray);
- if ($objChildItem) {
- $objPreviousItem->_objImportacionAsPAISOrigenArray[] = $objChildItem;
- }
- } else {
- $objPreviousItem->_objImportacionAsPAISOrigenArray[] = Importacion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'importacionaspaisorigen__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
- }
- $blnExpandedViaArray = true;
- }
- // Expanding reverse references: ImportacionAsPAISDestino
- $strAlias = $strAliasPrefix . 'importacionaspaisdestino__TRANSPORTE_idTRANSPORTE';
- $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
- if ((array_key_exists($strAlias, $strExpandAsArrayNodes)) &&
- (!is_null($objDbRow->GetColumn($strAliasName)))) {
- if ($intPreviousChildItemCount = count($objPreviousItem->_objImportacionAsPAISDestinoArray)) {
- $objPreviousChildItems = $objPreviousItem->_objImportacionAsPAISDestinoArray;
- $objChildItem = Importacion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'importacionaspaisdestino__', $strExpandAsArrayNodes, $objPreviousChildItems, $strColumnAliasArray);
- if ($objChildItem) {
- $objPreviousItem->_objImportacionAsPAISDestinoArray[] = $objChildItem;
- }
- } else {
- $objPreviousItem->_objImportacionAsPAISDestinoArray[] = Importacion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'importacionaspaisdestino__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
- }
- $blnExpandedViaArray = true;
- }
- // Expanding reverse references: ProveedorAsPAISIdPAIS
- $strAlias = $strAliasPrefix . 'proveedoraspaisidpais__idPROVEEDOR';
- $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
- if ((array_key_exists($strAlias, $strExpandAsArrayNodes)) &&
- (!is_null($objDbRow->GetColumn($strAliasName)))) {
- if ($intPreviousChildItemCount = count($objPreviousItem->_objProveedorAsPAISIdPAISArray)) {
- $objPreviousChildItems = $objPreviousItem->_objProveedorAsPAISIdPAISArray;
- $objChildItem = Proveedor::InstantiateDbRow($objDbRow, $strAliasPrefix . 'proveedoraspaisidpais__', $strExpandAsArrayNodes, $objPreviousChildItems, $strColumnAliasArray);
- if ($objChildItem) {
- $objPreviousItem->_objProveedorAsPAISIdPAISArray[] = $objChildItem;
- }
- } else {
- $objPreviousItem->_objProveedorAsPAISIdPAISArray[] = Proveedor::InstantiateDbRow($objDbRow, $strAliasPrefix . 'proveedoraspaisidpais__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
- }
- $blnExpandedViaArray = true;
- }
- // Expanding reverse references: TransporteAsPAISIdPAIS
- $strAlias = $strAliasPrefix . 'transporteaspaisidpais__idTRANSPORTE';
- $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
- if ((array_key_exists($strAlias, $strExpandAsArrayNodes)) &&
- (!is_null($objDbRow->GetColumn($strAliasName)))) {
- if ($intPreviousChildItemCount = count($objPreviousItem->_objTransporteAsPAISIdPAISArray)) {
- $objPreviousChildItems = $objPreviousItem->_objTransporteAsPAISIdPAISArray;
- $objChildItem = Transporte::InstantiateDbRow($objDbRow, $strAliasPrefix . 'transporteaspaisidpais__', $strExpandAsArrayNodes, $objPreviousChildItems, $strColumnAliasArray);
- if ($objChildItem) {
- $objPreviousItem->_objTransporteAsPAISIdPAISArray[] = $objChildItem;
- }
- } else {
- $objPreviousItem->_objTransporteAsPAISIdPAISArray[] = Transporte::InstantiateDbRow($objDbRow, $strAliasPrefix . 'transporteaspaisidpais__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
- }
- $blnExpandedViaArray = true;
- }
- // Either return false to signal array expansion, or check-to-reset the Alias prefix and move on
- if ($blnExpandedViaArray) {
- return false;
- } else if ($strAliasPrefix == 'PAIS__') {
- $strAliasPrefix = null;
- }
- }
- }
- }
- // Create a new instance of the Pais object
- $objToReturn = new Pais();
- $objToReturn->__blnRestored = true;
- $strAliasName = array_key_exists($strAliasPrefix . 'idPAIS', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'idPAIS'] : $strAliasPrefix . 'idPAIS';
- $objToReturn->intIdPAIS = $objDbRow->GetColumn($strAliasName, 'Integer');
- $strAliasName = array_key_exists($strAliasPrefix . 'nombre', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'nombre'] : $strAliasPrefix . 'nombre';
- $objToReturn->strNombre = $objDbRow->GetColumn($strAliasName, 'VarChar');
- if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
- foreach ($arrPreviousItems as $objPreviousItem) {
- if ($objToReturn->IdPAIS != $objPreviousItem->IdPAIS) {
- continue;
- }
- if (array_diff($objPreviousItem->_objImportacionAsPAISOrigenArray, $objToReturn->_objImportacionAsPAISOrigenArray) != null) {
- continue;
- }
- if (array_diff($objPreviousItem->_objImportacionAsPAISDestinoArray, $objToReturn->_objImportacionAsPAISDestinoArray) != null) {
- continue;
- }
- if (array_diff($objPreviousItem->_objProveedorAsPAISIdPAISArray, $objToReturn->_objProveedorAsPAISIdPAISArray) != null) {
- continue;
- }
- if (array_diff($objPreviousItem->_objTransporteAsPAISIdPAISArray, $objToReturn->_objTransporteAsPAISIdPAISArray) != null) {
- continue;
- }
- // complete match - all primary key columns are the same
- return null;
- }
- }
- // Instantiate Virtual Attributes
- foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
- $strVirtualPrefix = $strAliasPrefix . '__';
- $strVirtualPrefixLength = strlen($strVirtualPrefix);
- if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
- $objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
- }
- // Prepare to Check for Early/Virtual Binding
- if (!$strAliasPrefix)
- $strAliasPrefix = 'PAIS__';
- // Check for ImportacionAsPAISOrigen Virtual Binding
- $strAlias = $strAliasPrefix . 'importacionaspaisorigen__TRANSPORTE_idTRANSPORTE';
- $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
- if (!is_null($objDbRow->GetColumn($strAliasName))) {
- if (($strExpandAsArrayNodes) && (array_key_exists($strAlias, $strExpandAsArrayNodes)))
- $objToReturn->_objImportacionAsPAISOrigenArray[] = Importacion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'importacionaspaisorigen__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
- else
- $objToReturn->_objImportacionAsPAISOrigen = Importacion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'importacionaspaisorigen__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
- }
- // Check for ImportacionAsPAISDestino Virtual Binding
- $strAlias = $strAliasPrefix . 'importacionaspaisdestino__TRANSPORTE_idTRANSPORTE';
- $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
- if (!is_null($objDbRow->GetColumn($strAliasName))) {
- if (($strExpandAsArrayNodes) && (array_key_exists($strAlias, $strExpandAsArrayNodes)))
- $objToReturn->_objImportacionAsPAISDestinoArray[] = Importacion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'importacionaspaisdestino__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
- else
- $objToReturn->_objImportacionAsPAISDestino = Importacion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'importacionaspaisdestino__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
- }
- // Check for ProveedorAsPAISIdPAIS Virtual Binding
- $strAlias = $strAliasPrefix . 'proveedoraspaisidpais__idPROVEEDOR';
- $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
- if (!is_null($objDbRow->GetColumn($strAliasName))) {
- if (($strExpandAsArrayNodes) && (array_key_exists($strAlias, $strExpandAsArrayNodes)))
- $objToReturn->_objProveedorAsPAISIdPAISArray[] = Proveedor::InstantiateDbRow($objDbRow, $strAliasPrefix . 'proveedoraspaisidpais__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
- else
- $objToReturn->_objProveedorAsPAISIdPAIS = Proveedor::InstantiateDbRow($objDbRow, $strAliasPrefix . 'proveedoraspaisidpais__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
- }
- // Check for TransporteAsPAISIdPAIS Virtual Binding
- $strAlias = $strAliasPrefix . 'transporteaspaisidpais__idTRANSPORTE';
- $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
- if (!is_null($objDbRow->GetColumn($strAliasName))) {
- if (($strExpandAsArrayNodes) && (array_key_exists($strAlias, $strExpandAsArrayNodes)))
- $objToReturn->_objTransporteAsPAISIdPAISArray[] = Transporte::InstantiateDbRow($objDbRow, $strAliasPrefix . 'transporteaspaisidpais__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
- else
- $objToReturn->_objTransporteAsPAISIdPAIS = Transporte::InstantiateDbRow($objDbRow, $strAliasPrefix . 'transporteaspaisidpais__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
- }
- return $objToReturn;
- }
- /**
- * Instantiate an array of Paises from a Database Result
- * @param DatabaseResultBase $objDbResult
- * @param string $strExpandAsArrayNodes
- * @param string[] $strColumnAliasArray
- * @return Pais[]
- */
- public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
- $objToReturn = array();
-
- if (!$strColumnAliasArray)
- $strColumnAliasArray = array();
- // If blank resultset, then return empty array
- if (!$objDbResult)
- return $objToReturn;
- // Load up the return array with each row
- if ($strExpandAsArrayNodes) {
- $objToReturn = array();
- while ($objDbRow = $objDbResult->GetNextRow()) {
- $objItem = Pais::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objToReturn, $strColumnAliasArray);
- if ($objItem) {
- $objToReturn[] = $objItem;
- }
- }
- } else {
- while ($objDbRow = $objDbResult->GetNextRow())
- $objToReturn[] = Pais::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
- }
- return $objToReturn;
- }
- ///////////////////////////////////////////////////
- // INDEX-BASED LOAD METHODS (Single Load and Array)
- ///////////////////////////////////////////////////
-
- /**
- * Load a single Pais object,
- * by IdPAIS Index(es)
- * @param integer $intIdPAIS
- * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
- * @return Pais
- */
- public static function LoadByIdPAIS($intIdPAIS, $objOptionalClauses = null) {
- return Pais::QuerySingle(
- QQ::AndCondition(
- QQ::Equal(QQN::Pais()->IdPAIS, $intIdPAIS)
- ),
- $objOptionalClauses
- );
- }
- ////////////////////////////////////////////////////
- // INDEX-BASED LOAD METHODS (Array via Many to Many)
- ////////////////////////////////////////////////////
- //////////////////////////
- // SAVE, DELETE AND RELOAD
- //////////////////////////
- /**
- * Save this Pais
- * @param bool $blnForceInsert
- * @param bool $blnForceUpdate
- * @return int
- */
- public function Save($blnForceInsert = false, $blnForceUpdate = false) {
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- $mixToReturn = null;
- try {
- if ((!$this->__blnRestored) || ($blnForceInsert)) {
- // Perform an INSERT query
- $objDatabase->NonQuery('
- INSERT INTO `PAIS` (
- `nombre`
- ) VALUES (
- ' . $objDatabase->SqlVariable($this->strNombre) . '
- )
- ');
- // Update Identity column and return its value
- $mixToReturn = $this->intIdPAIS = $objDatabase->InsertId('PAIS', 'idPAIS');
- } else {
- // Perform an UPDATE query
- // First checking for Optimistic Locking constraints (if applicable)
- // Perform the UPDATE query
- $objDatabase->NonQuery('
- UPDATE
- `PAIS`
- SET
- `nombre` = ' . $objDatabase->SqlVariable($this->strNombre) . '
- WHERE
- `idPAIS` = ' . $objDatabase->SqlVariable($this->intIdPAIS) . '
- ');
- }
- } catch (QCallerException $objExc) {
- $objExc->IncrementOffset();
- throw $objExc;
- }
- // Update __blnRestored and any Non-Identity PK Columns (if applicable)
- $this->__blnRestored = true;
- // Return
- return $mixToReturn;
- }
- /**
- * Delete this Pais
- * @return void
- */
- public function Delete() {
- if ((is_null($this->intIdPAIS)))
- throw new QUndefinedPrimaryKeyException('Cannot delete this Pais with an unset primary key.');
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- // Perform the SQL Query
- $objDatabase->NonQuery('
- DELETE FROM
- `PAIS`
- WHERE
- `idPAIS` = ' . $objDatabase->SqlVariable($this->intIdPAIS) . '');
- }
- /**
- * Delete all Paises
- * @return void
- */
- public static function DeleteAll() {
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- // Perform the Query
- $objDatabase->NonQuery('
- DELETE FROM
- `PAIS`');
- }
- /**
- * Truncate PAIS table
- * @return void
- */
- public static function Truncate() {
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- // Perform the Query
- $objDatabase->NonQuery('
- TRUNCATE `PAIS`');
- }
- /**
- * Reload this Pais from the database.
- * @return void
- */
- public function Reload() {
- // Make sure we are actually Restored from the database
- if (!$this->__blnRestored)
- throw new QCallerException('Cannot call Reload() on a new, unsaved Pais object.');
- // Reload the Object
- $objReloaded = Pais::Load($this->intIdPAIS);
- // Update $this's local variables to match
- $this->strNombre = $objReloaded->strNombre;
- }
- ////////////////////
- // PUBLIC OVERRIDERS
- ////////////////////
- /**
- * Override method to perform a property "Get"
- * This will get the value of $strName
- *
- * @param string $strName Name of the property to get
- * @return mixed
- */
- public function __get($strName) {
- switch ($strName) {
- ///////////////////
- // Member Variables
- ///////////////////
- case 'IdPAIS':
- /**
- * Gets the value for intIdPAIS (Read-Only PK)
- * @return integer
- */
- return $this->intIdPAIS;
- case 'Nombre':
- /**
- * Gets the value for strNombre
- * @return string
- */
- return $this->strNombre;
- ///////////////////
- // Member Objects
- ///////////////////
- ////////////////////////////
- // Virtual Object References (Many to Many and Reverse References)
- // (If restored via a "Many-to" expansion)
- ////////////////////////////
- case '_ImportacionAsPAISOrigen':
- /**
- * Gets the value for the private _objImportacionAsPAISOrigen (Read-Only)
- * if set due to an expansion on the IMPORTACION.PAIS_Origen reverse relationship
- * @return Importacion
- */
- return $this->_objImportacionAsPAISOrigen;
- case '_ImportacionAsPAISOrigenArray':
- /**
- * Gets the value for the private _objImportacionAsPAISOrigenArray (Read-Only)
- * if set due to an ExpandAsArray on the IMPORTACION.PAIS_Origen reverse relationship
- * @return Importacion[]
- */
- return (array) $this->_objImportacionAsPAISOrigenArray;
- case '_ImportacionAsPAISDestino':
- /**
- * Gets the value for the private _objImportacionAsPAISDestino (Read-Only)
- * if set due to an expansion on the IMPORTACION.PAIS_Destino reverse relationship
- * @return Importacion
- */
- return $this->_objImportacionAsPAISDestino;
- case '_ImportacionAsPAISDestinoArray':
- /**
- * Gets the value for the private _objImportacionAsPAISDestinoArray (Read-Only)
- * if set due to an ExpandAsArray on the IMPORTACION.PAIS_Destino reverse relationship
- * @return Importacion[]
- */
- return (array) $this->_objImportacionAsPAISDestinoArray;
- case '_ProveedorAsPAISIdPAIS':
- /**
- * Gets the value for the private _objProveedorAsPAISIdPAIS (Read-Only)
- * if set due to an expansion on the PROVEEDOR.PAIS_idPAIS reverse relationship
- * @return Proveedor
- */
- return $this->_objProveedorAsPAISIdPAIS;
- case '_ProveedorAsPAISIdPAISArray':
- /**
- * Gets the value for the private _objProveedorAsPAISIdPAISArray (Read-Only)
- * if set due to an ExpandAsArray on the PROVEEDOR.PAIS_idPAIS reverse relationship
- * @return Proveedor[]
- */
- return (array) $this->_objProveedorAsPAISIdPAISArray;
- case '_TransporteAsPAISIdPAIS':
- /**
- * Gets the value for the private _objTransporteAsPAISIdPAIS (Read-Only)
- * if set due to an expansion on the TRANSPORTE.PAIS_idPAIS reverse relationship
- * @return Transporte
- */
- return $this->_objTransporteAsPAISIdPAIS;
- case '_TransporteAsPAISIdPAISArray':
- /**
- * Gets the value for the private _objTransporteAsPAISIdPAISArray (Read-Only)
- * if set due to an ExpandAsArray on the TRANSPORTE.PAIS_idPAIS reverse relationship
- * @return Transporte[]
- */
- return (array) $this->_objTransporteAsPAISIdPAISArray;
- case '__Restored':
- return $this->__blnRestored;
- default:
- try {
- return parent::__get($strName);
- } catch (QCallerException $objExc) {
- $objExc->IncrementOffset();
- throw $objExc;
- }
- }
- }
- /**
- * Override method to perform a property "Set"
- * This will set the property $strName to be $mixValue
- *
- * @param string $strName Name of the property to set
- * @param string $mixValue New value of the property
- * @return mixed
- */
- public function __set($strName, $mixValue) {
- switch ($strName) {
- ///////////////////
- // Member Variables
- ///////////////////
- case 'Nombre':
- /**
- * Sets the value for strNombre
- * @param string $mixValue
- * @return string
- */
- try {
- return ($this->strNombre = QType::Cast($mixValue, QType::String));
- } catch (QCallerException $objExc) {
- $objExc->IncrementOffset();
- throw $objExc;
- }
- ///////////////////
- // Member Objects
- ///////////////////
- default:
- try {
- return parent::__set($strName, $mixValue);
- } catch (QCallerException $objExc) {
- $objExc->IncrementOffset();
- throw $objExc;
- }
- }
- }
- /**
- * Lookup a VirtualAttribute value (if applicable). Returns NULL if none found.
- * @param string $strName
- * @return string
- */
- public function GetVirtualAttribute($strName) {
- if (array_key_exists($strName, $this->__strVirtualAttributeArray))
- return $this->__strVirtualAttributeArray[$strName];
- return null;
- }
- ///////////////////////////////
- // ASSOCIATED OBJECTS' METHODS
- ///////////////////////////////
-
-
- // Related Objects' Methods for ImportacionAsPAISOrigen
- //-------------------------------------------------------------------
- /**
- * Gets all associated ImportacionsAsPAISOrigen as an array of Importacion objects
- * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
- * @return Importacion[]
- */
- public function GetImportacionAsPAISOrigenArray($objOptionalClauses = null) {
- if ((is_null($this->intIdPAIS)))
- return array();
- try {
- return Importacion::LoadArrayByPAISOrigen($this->intIdPAIS, $objOptionalClauses);
- } catch (QCallerException $objExc) {
- $objExc->IncrementOffset();
- throw $objExc;
- }
- }
- /**
- * Counts all associated ImportacionsAsPAISOrigen
- * @return int
- */
- public function CountImportacionsAsPAISOrigen() {
- if ((is_null($this->intIdPAIS)))
- return 0;
- return Importacion::CountByPAISOrigen($this->intIdPAIS);
- }
- /**
- * Associates a ImportacionAsPAISOrigen
- * @param Importacion $objImportacion
- * @return void
- */
- public function AssociateImportacionAsPAISOrigen(Importacion $objImportacion) {
- if ((is_null($this->intIdPAIS)))
- throw new QUndefinedPrimaryKeyException('Unable to call AssociateImportacionAsPAISOrigen on this unsaved Pais.');
- if ((is_null($objImportacion->TRANSPORTEIdTRANSPORTE)) || (is_null($objImportacion->LICENCIAIdLICENCIA)))
- throw new QUndefinedPrimaryKeyException('Unable to call AssociateImportacionAsPAISOrigen on this Pais with an unsaved Importacion.');
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- // Perform the SQL Query
- $objDatabase->NonQuery('
- UPDATE
- `IMPORTACION`
- SET
- `PAIS_Origen` = ' . $objDatabase->SqlVariable($this->intIdPAIS) . '
- WHERE
- `TRANSPORTE_idTRANSPORTE` = ' . $objDatabase->SqlVariable($objImportacion->TRANSPORTEIdTRANSPORTE) . ' AND
- `LICENCIA_idLICENCIA` = ' . $objDatabase->SqlVariable($objImportacion->LICENCIAIdLICENCIA) . '
- ');
- }
- /**
- * Unassociates a ImportacionAsPAISOrigen
- * @param Importacion $objImportacion
- * @return void
- */
- public function UnassociateImportacionAsPAISOrigen(Importacion $objImportacion) {
- if ((is_null($this->intIdPAIS)))
- throw new QUndefinedPrimaryKeyException('Unable to call UnassociateImportacionAsPAISOrigen on this unsaved Pais.');
- if ((is_null($objImportacion->TRANSPORTEIdTRANSPORTE)) || (is_null($objImportacion->LICENCIAIdLICENCIA)))
- throw new QUndefinedPrimaryKeyException('Unable to call UnassociateImportacionAsPAISOrigen on this Pais with an unsaved Importacion.');
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- // Perform the SQL Query
- $objDatabase->NonQuery('
- UPDATE
- `IMPORTACION`
- SET
- `PAIS_Origen` = null
- WHERE
- `TRANSPORTE_idTRANSPORTE` = ' . $objDatabase->SqlVariable($objImportacion->TRANSPORTEIdTRANSPORTE) . ' AND
- `LICENCIA_idLICENCIA` = ' . $objDatabase->SqlVariable($objImportacion->LICENCIAIdLICENCIA) . ' AND
- `PAIS_Origen` = ' . $objDatabase->SqlVariable($this->intIdPAIS) . '
- ');
- }
- /**
- * Unassociates all ImportacionsAsPAISOrigen
- * @return void
- */
- public function UnassociateAllImportacionsAsPAISOrigen() {
- if ((is_null($this->intIdPAIS)))
- throw new QUndefinedPrimaryKeyException('Unable to call UnassociateImportacionAsPAISOrigen on this unsaved Pais.');
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- // Perform the SQL Query
- $objDatabase->NonQuery('
- UPDATE
- `IMPORTACION`
- SET
- `PAIS_Origen` = null
- WHERE
- `PAIS_Origen` = ' . $objDatabase->SqlVariable($this->intIdPAIS) . '
- ');
- }
- /**
- * Deletes an associated ImportacionAsPAISOrigen
- * @param Importacion $objImportacion
- * @return void
- */
- public function DeleteAssociatedImportacionAsPAISOrigen(Importacion $objImportacion) {
- if ((is_null($this->intIdPAIS)))
- throw new QUndefinedPrimaryKeyException('Unable to call UnassociateImportacionAsPAISOrigen on this unsaved Pais.');
- if ((is_null($objImportacion->TRANSPORTEIdTRANSPORTE)) || (is_null($objImportacion->LICENCIAIdLICENCIA)))
- throw new QUndefinedPrimaryKeyException('Unable to call UnassociateImportacionAsPAISOrigen on this Pais with an unsaved Importacion.');
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- // Perform the SQL Query
- $objDatabase->NonQuery('
- DELETE FROM
- `IMPORTACION`
- WHERE
- `TRANSPORTE_idTRANSPORTE` = ' . $objDatabase->SqlVariable($objImportacion->TRANSPORTEIdTRANSPORTE) . ' AND
- `LICENCIA_idLICENCIA` = ' . $objDatabase->SqlVariable($objImportacion->LICENCIAIdLICENCIA) . ' AND
- `PAIS_Origen` = ' . $objDatabase->SqlVariable($this->intIdPAIS) . '
- ');
- }
- /**
- * Deletes all associated ImportacionsAsPAISOrigen
- * @return void
- */
- public function DeleteAllImportacionsAsPAISOrigen() {
- if ((is_null($this->intIdPAIS)))
- throw new QUndefinedPrimaryKeyException('Unable to call UnassociateImportacionAsPAISOrigen on this unsaved Pais.');
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- // Perform the SQL Query
- $objDatabase->NonQuery('
- DELETE FROM
- `IMPORTACION`
- WHERE
- `PAIS_Origen` = ' . $objDatabase->SqlVariable($this->intIdPAIS) . '
- ');
- }
-
-
- // Related Objects' Methods for ImportacionAsPAISDestino
- //-------------------------------------------------------------------
- /**
- * Gets all associated ImportacionsAsPAISDestino as an array of Importacion objects
- * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
- * @return Importacion[]
- */
- public function GetImportacionAsPAISDestinoArray($objOptionalClauses = null) {
- if ((is_null($this->intIdPAIS)))
- return array();
- try {
- return Importacion::LoadArrayByPAISDestino($this->intIdPAIS, $objOptionalClauses);
- } catch (QCallerException $objExc) {
- $objExc->IncrementOffset();
- throw $objExc;
- }
- }
- /**
- * Counts all associated ImportacionsAsPAISDestino
- * @return int
- */
- public function CountImportacionsAsPAISDestino() {
- if ((is_null($this->intIdPAIS)))
- return 0;
- return Importacion::CountByPAISDestino($this->intIdPAIS);
- }
- /**
- * Associates a ImportacionAsPAISDestino
- * @param Importacion $objImportacion
- * @return void
- */
- public function AssociateImportacionAsPAISDestino(Importacion $objImportacion) {
- if ((is_null($this->intIdPAIS)))
- throw new QUndefinedPrimaryKeyException('Unable to call AssociateImportacionAsPAISDestino on this unsaved Pais.');
- if ((is_null($objImportacion->TRANSPORTEIdTRANSPORTE)) || (is_null($objImportacion->LICENCIAIdLICENCIA)))
- throw new QUndefinedPrimaryKeyException('Unable to call AssociateImportacionAsPAISDestino on this Pais with an unsaved Importacion.');
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- // Perform the SQL Query
- $objDatabase->NonQuery('
- UPDATE
- `IMPORTACION`
- SET
- `PAIS_Destino` = ' . $objDatabase->SqlVariable($this->intIdPAIS) . '
- WHERE
- `TRANSPORTE_idTRANSPORTE` = ' . $objDatabase->SqlVariable($objImportacion->TRANSPORTEIdTRANSPORTE) . ' AND
- `LICENCIA_idLICENCIA` = ' . $objDatabase->SqlVariable($objImportacion->LICENCIAIdLICENCIA) . '
- ');
- }
- /**
- * Unassociates a ImportacionAsPAISDestino
- * @param Importacion $objImportacion
- * @return void
- */
- public function UnassociateImportacionAsPAISDestino(Importacion $objImportacion) {
- if ((is_null($this->intIdPAIS)))
- throw new QUndefinedPrimaryKeyException('Unable to call UnassociateImportacionAsPAISDestino on this unsaved Pais.');
- if ((is_null($objImportacion->TRANSPORTEIdTRANSPORTE)) || (is_null($objImportacion->LICENCIAIdLICENCIA)))
- throw new QUndefinedPrimaryKeyException('Unable to call UnassociateImportacionAsPAISDestino on this Pais with an unsaved Importacion.');
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- // Perform the SQL Query
- $objDatabase->NonQuery('
- UPDATE
- `IMPORTACION`
- SET
- `PAIS_Destino` = null
- WHERE
- `TRANSPORTE_idTRANSPORTE` = ' . $objDatabase->SqlVariable($objImportacion->TRANSPORTEIdTRANSPORTE) . ' AND
- `LICENCIA_idLICENCIA` = ' . $objDatabase->SqlVariable($objImportacion->LICENCIAIdLICENCIA) . ' AND
- `PAIS_Destino` = ' . $objDatabase->SqlVariable($this->intIdPAIS) . '
- ');
- }
- /**
- * Unassociates all ImportacionsAsPAISDestino
- * @return void
- */
- public function UnassociateAllImportacionsAsPAISDestino() {
- if ((is_null($this->intIdPAIS)))
- throw new QUndefinedPrimaryKeyException('Unable to call UnassociateImportacionAsPAISDestino on this unsaved Pais.');
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- // Perform the SQL Query
- $objDatabase->NonQuery('
- UPDATE
- `IMPORTACION`
- SET
- `PAIS_Destino` = null
- WHERE
- `PAIS_Destino` = ' . $objDatabase->SqlVariable($this->intIdPAIS) . '
- ');
- }
- /**
- * Deletes an associated ImportacionAsPAISDestino
- * @param Importacion $objImportacion
- * @return void
- */
- public function DeleteAssociatedImportacionAsPAISDestino(Importacion $objImportacion) {
- if ((is_null($this->intIdPAIS)))
- throw new QUndefinedPrimaryKeyException('Unable to call UnassociateImportacionAsPAISDestino on this unsaved Pais.');
- if ((is_null($objImportacion->TRANSPORTEIdTRANSPORTE)) || (is_null($objImportacion->LICENCIAIdLICENCIA)))
- throw new QUndefinedPrimaryKeyException('Unable to call UnassociateImportacionAsPAISDestino on this Pais with an unsaved Importacion.');
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- // Perform the SQL Query
- $objDatabase->NonQuery('
- DELETE FROM
- `IMPORTACION`
- WHERE
- `TRANSPORTE_idTRANSPORTE` = ' . $objDatabase->SqlVariable($objImportacion->TRANSPORTEIdTRANSPORTE) . ' AND
- `LICENCIA_idLICENCIA` = ' . $objDatabase->SqlVariable($objImportacion->LICENCIAIdLICENCIA) . ' AND
- `PAIS_Destino` = ' . $objDatabase->SqlVariable($this->intIdPAIS) . '
- ');
- }
- /**
- * Deletes all associated ImportacionsAsPAISDestino
- * @return void
- */
- public function DeleteAllImportacionsAsPAISDestino() {
- if ((is_null($this->intIdPAIS)))
- throw new QUndefinedPrimaryKeyException('Unable to call UnassociateImportacionAsPAISDestino on this unsaved Pais.');
- // Get the Database Object for this Class
- $objDatabase = Pais::GetDatabase();
- // Perform the SQL Query
- $objDatabase->NonQuery('
- DELETE FROM
- `IMPORTACION`
- WHERE
- `PAIS_Destino` = ' . $objDatabase->SqlVariable($this->intIdPAIS) . '
- ');
- }
-
-
- // Related Objects' Methods for ProveedorAsPAISIdPAIS
- //-------------------------------------------------------------------
- /**
- * Gets all associated ProveedorsAsPAISIdPAIS as an array of Proveedor objects
- * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
- * @return Proveedor[]
- */
- public function GetProveedorAsPAISIdPAISArray($objOptionalClauses = null) {
- if ((is_null($this->intIdPAIS)))
- return array();
- try {
- return Proveedor::LoadArrayByPAISIdPAIS($this->intIdPAIS, $objOptionalClauses);
- } catch (QCallerException $objExc) {
- …
Large files files are truncated, but you can click here to view the full file