PageRenderTime 54ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/sgl/includes/model/generated/LicenciaGen.class.php

http://logisticsouth.googlecode.com/
PHP | 1457 lines | 710 code | 190 blank | 557 comment | 121 complexity | e9c253c726465692570462902c53f226 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

  1. <?php
  2. /**
  3. * The abstract LicenciaGen class defined here is
  4. * code-generated and contains all the basic CRUD-type functionality as well as
  5. * basic methods to handle relationships and index-based loading.
  6. *
  7. * To use, you should use the Licencia subclass which
  8. * extends this LicenciaGen class.
  9. *
  10. * Because subsequent re-code generations will overwrite any changes to this
  11. * file, you should leave this file unaltered to prevent yourself from losing
  12. * any information or code changes. All customizations should be done by
  13. * overriding existing or implementing new methods, properties and variables
  14. * in the Licencia class.
  15. *
  16. * @package My QCubed Application
  17. * @subpackage GeneratedDataObjects
  18. * @property-read integer $IdLICENCIA the value for intIdLICENCIA (Read-Only PK)
  19. * @property integer $EMPRESAIdEMPRESA the value for intEMPRESAIdEMPRESA (Not Null)
  20. * @property integer $PROVEEDORIdPROVEEDOR the value for intPROVEEDORIdPROVEEDOR (Not Null)
  21. * @property QDateTime $FechaInicio the value for dttFechaInicio (Not Null)
  22. * @property QDateTime $FechaFin the value for dttFechaFin
  23. * @property QDateTime $FechaFinEstimada the value for dttFechaFinEstimada
  24. * @property string $NumeroProforma the value for strNumeroProforma
  25. * @property string $NumeroCNP the value for strNumeroCNP
  26. * @property QDateTime $VencimientoCNP the value for dttVencimientoCNP
  27. * @property string $Status the value for strStatus (Not Null)
  28. * @property string $FormaPago the value for strFormaPago
  29. * @property string $Tipo the value for strTipo
  30. * @property double $Flete the value for fltFlete
  31. * @property string $Seguro the value for strSeguro
  32. * @property integer $PROCESOIdPROCESO the value for intPROCESOIdPROCESO (Not Null)
  33. * @property Empresa $EMPRESAIdEMPRESAObject the value for the Empresa object referenced by intEMPRESAIdEMPRESA (Not Null)
  34. * @property Proveedor $PROVEEDORIdPROVEEDORObject the value for the Proveedor object referenced by intPROVEEDORIdPROVEEDOR (Not Null)
  35. * @property Proceso $PROCESOIdPROCESOObject the value for the Proceso object referenced by intPROCESOIdPROCESO (Not Null)
  36. * @property-read CodigoPago $_CodigoPagoAsLICENCIAIdLICENCIA the value for the private _objCodigoPagoAsLICENCIAIdLICENCIA (Read-Only) if set due to an expansion on the CODIGO_PAGO.LICENCIA_idLICENCIA reverse relationship
  37. * @property-read CodigoPago[] $_CodigoPagoAsLICENCIAIdLICENCIAArray the value for the private _objCodigoPagoAsLICENCIAIdLICENCIAArray (Read-Only) if set due to an ExpandAsArray on the CODIGO_PAGO.LICENCIA_idLICENCIA reverse relationship
  38. * @property-read FaseLicencia $_FaseLicenciaAsLICENCIAIdLICENCIA the value for the private _objFaseLicenciaAsLICENCIAIdLICENCIA (Read-Only) if set due to an expansion on the FASE_LICENCIA.LICENCIA_idLICENCIA reverse relationship
  39. * @property-read FaseLicencia[] $_FaseLicenciaAsLICENCIAIdLICENCIAArray the value for the private _objFaseLicenciaAsLICENCIAIdLICENCIAArray (Read-Only) if set due to an ExpandAsArray on the FASE_LICENCIA.LICENCIA_idLICENCIA reverse relationship
  40. * @property-read Importacion $_ImportacionAsLICENCIAIdLICENCIA the value for the private _objImportacionAsLICENCIAIdLICENCIA (Read-Only) if set due to an expansion on the IMPORTACION.LICENCIA_idLICENCIA reverse relationship
  41. * @property-read Importacion[] $_ImportacionAsLICENCIAIdLICENCIAArray the value for the private _objImportacionAsLICENCIAIdLICENCIAArray (Read-Only) if set due to an ExpandAsArray on the IMPORTACION.LICENCIA_idLICENCIA reverse relationship
  42. * @property-read ListaProducto $_ListaProductoAsLICENCIAIdLICENCIA the value for the private _objListaProductoAsLICENCIAIdLICENCIA (Read-Only) if set due to an expansion on the LISTA_PRODUCTO.LICENCIA_idLICENCIA reverse relationship
  43. * @property-read ListaProducto[] $_ListaProductoAsLICENCIAIdLICENCIAArray the value for the private _objListaProductoAsLICENCIAIdLICENCIAArray (Read-Only) if set due to an ExpandAsArray on the LISTA_PRODUCTO.LICENCIA_idLICENCIA reverse relationship
  44. * @property-read Responsable $_ResponsableAsLICENCIAIdLICENCIA the value for the private _objResponsableAsLICENCIAIdLICENCIA (Read-Only) if set due to an expansion on the RESPONSABLE.LICENCIA_idLICENCIA reverse relationship
  45. * @property-read Responsable[] $_ResponsableAsLICENCIAIdLICENCIAArray the value for the private _objResponsableAsLICENCIAIdLICENCIAArray (Read-Only) if set due to an ExpandAsArray on the RESPONSABLE.LICENCIA_idLICENCIA reverse relationship
  46. * @property-read VigenciaDocumento $_VigenciaDocumentoAsLICENCIAIdLICENCIA the value for the private _objVigenciaDocumentoAsLICENCIAIdLICENCIA (Read-Only) if set due to an expansion on the VIGENCIA_DOCUMENTO.LICENCIA_idLICENCIA reverse relationship
  47. * @property-read VigenciaDocumento[] $_VigenciaDocumentoAsLICENCIAIdLICENCIAArray the value for the private _objVigenciaDocumentoAsLICENCIAIdLICENCIAArray (Read-Only) if set due to an ExpandAsArray on the VIGENCIA_DOCUMENTO.LICENCIA_idLICENCIA reverse relationship
  48. * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
  49. */
  50. class LicenciaGen extends QBaseClass implements IteratorAggregate {
  51. ///////////////////////////////////////////////////////////////////////
  52. // PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
  53. ///////////////////////////////////////////////////////////////////////
  54. /**
  55. * Protected member variable that maps to the database PK Identity column LICENCIA.idLICENCIA
  56. * @var integer intIdLICENCIA
  57. */
  58. protected $intIdLICENCIA;
  59. const IdLICENCIADefault = null;
  60. /**
  61. * Protected member variable that maps to the database column LICENCIA.EMPRESA_idEMPRESA
  62. * @var integer intEMPRESAIdEMPRESA
  63. */
  64. protected $intEMPRESAIdEMPRESA;
  65. const EMPRESAIdEMPRESADefault = null;
  66. /**
  67. * Protected member variable that maps to the database column LICENCIA.PROVEEDOR_idPROVEEDOR
  68. * @var integer intPROVEEDORIdPROVEEDOR
  69. */
  70. protected $intPROVEEDORIdPROVEEDOR;
  71. const PROVEEDORIdPROVEEDORDefault = null;
  72. /**
  73. * Protected member variable that maps to the database column LICENCIA.fechaInicio
  74. * @var QDateTime dttFechaInicio
  75. */
  76. protected $dttFechaInicio;
  77. const FechaInicioDefault = null;
  78. /**
  79. * Protected member variable that maps to the database column LICENCIA.fechaFin
  80. * @var QDateTime dttFechaFin
  81. */
  82. protected $dttFechaFin;
  83. const FechaFinDefault = null;
  84. /**
  85. * Protected member variable that maps to the database column LICENCIA.fechaFinEstimada
  86. * @var QDateTime dttFechaFinEstimada
  87. */
  88. protected $dttFechaFinEstimada;
  89. const FechaFinEstimadaDefault = null;
  90. /**
  91. * Protected member variable that maps to the database column LICENCIA.numeroProforma
  92. * @var string strNumeroProforma
  93. */
  94. protected $strNumeroProforma;
  95. const NumeroProformaMaxLength = 45;
  96. const NumeroProformaDefault = null;
  97. /**
  98. * Protected member variable that maps to the database column LICENCIA.numeroCNP
  99. * @var string strNumeroCNP
  100. */
  101. protected $strNumeroCNP;
  102. const NumeroCNPMaxLength = 45;
  103. const NumeroCNPDefault = null;
  104. /**
  105. * Protected member variable that maps to the database column LICENCIA.vencimientoCNP
  106. * @var QDateTime dttVencimientoCNP
  107. */
  108. protected $dttVencimientoCNP;
  109. const VencimientoCNPDefault = null;
  110. /**
  111. * Protected member variable that maps to the database column LICENCIA.status
  112. * @var string strStatus
  113. */
  114. protected $strStatus;
  115. const StatusMaxLength = 45;
  116. const StatusDefault = null;
  117. /**
  118. * Protected member variable that maps to the database column LICENCIA.formaPago
  119. * @var string strFormaPago
  120. */
  121. protected $strFormaPago;
  122. const FormaPagoMaxLength = 45;
  123. const FormaPagoDefault = null;
  124. /**
  125. * Protected member variable that maps to the database column LICENCIA.tipo
  126. * @var string strTipo
  127. */
  128. protected $strTipo;
  129. const TipoMaxLength = 45;
  130. const TipoDefault = null;
  131. /**
  132. * Protected member variable that maps to the database column LICENCIA.flete
  133. * @var double fltFlete
  134. */
  135. protected $fltFlete;
  136. const FleteDefault = null;
  137. /**
  138. * Protected member variable that maps to the database column LICENCIA.seguro
  139. * @var string strSeguro
  140. */
  141. protected $strSeguro;
  142. const SeguroMaxLength = 45;
  143. const SeguroDefault = null;
  144. /**
  145. * Protected member variable that maps to the database column LICENCIA.PROCESO_idPROCESO
  146. * @var integer intPROCESOIdPROCESO
  147. */
  148. protected $intPROCESOIdPROCESO;
  149. const PROCESOIdPROCESODefault = null;
  150. /**
  151. * Private member variable that stores a reference to a single CodigoPagoAsLICENCIAIdLICENCIA object
  152. * (of type CodigoPago), if this Licencia object was restored with
  153. * an expansion on the CODIGO_PAGO association table.
  154. * @var CodigoPago _objCodigoPagoAsLICENCIAIdLICENCIA;
  155. */
  156. private $_objCodigoPagoAsLICENCIAIdLICENCIA;
  157. /**
  158. * Private member variable that stores a reference to an array of CodigoPagoAsLICENCIAIdLICENCIA objects
  159. * (of type CodigoPago[]), if this Licencia object was restored with
  160. * an ExpandAsArray on the CODIGO_PAGO association table.
  161. * @var CodigoPago[] _objCodigoPagoAsLICENCIAIdLICENCIAArray;
  162. */
  163. private $_objCodigoPagoAsLICENCIAIdLICENCIAArray = array();
  164. /**
  165. * Private member variable that stores a reference to a single FaseLicenciaAsLICENCIAIdLICENCIA object
  166. * (of type FaseLicencia), if this Licencia object was restored with
  167. * an expansion on the FASE_LICENCIA association table.
  168. * @var FaseLicencia _objFaseLicenciaAsLICENCIAIdLICENCIA;
  169. */
  170. private $_objFaseLicenciaAsLICENCIAIdLICENCIA;
  171. /**
  172. * Private member variable that stores a reference to an array of FaseLicenciaAsLICENCIAIdLICENCIA objects
  173. * (of type FaseLicencia[]), if this Licencia object was restored with
  174. * an ExpandAsArray on the FASE_LICENCIA association table.
  175. * @var FaseLicencia[] _objFaseLicenciaAsLICENCIAIdLICENCIAArray;
  176. */
  177. private $_objFaseLicenciaAsLICENCIAIdLICENCIAArray = array();
  178. /**
  179. * Private member variable that stores a reference to a single ImportacionAsLICENCIAIdLICENCIA object
  180. * (of type Importacion), if this Licencia object was restored with
  181. * an expansion on the IMPORTACION association table.
  182. * @var Importacion _objImportacionAsLICENCIAIdLICENCIA;
  183. */
  184. private $_objImportacionAsLICENCIAIdLICENCIA;
  185. /**
  186. * Private member variable that stores a reference to an array of ImportacionAsLICENCIAIdLICENCIA objects
  187. * (of type Importacion[]), if this Licencia object was restored with
  188. * an ExpandAsArray on the IMPORTACION association table.
  189. * @var Importacion[] _objImportacionAsLICENCIAIdLICENCIAArray;
  190. */
  191. private $_objImportacionAsLICENCIAIdLICENCIAArray = array();
  192. /**
  193. * Private member variable that stores a reference to a single ListaProductoAsLICENCIAIdLICENCIA object
  194. * (of type ListaProducto), if this Licencia object was restored with
  195. * an expansion on the LISTA_PRODUCTO association table.
  196. * @var ListaProducto _objListaProductoAsLICENCIAIdLICENCIA;
  197. */
  198. private $_objListaProductoAsLICENCIAIdLICENCIA;
  199. /**
  200. * Private member variable that stores a reference to an array of ListaProductoAsLICENCIAIdLICENCIA objects
  201. * (of type ListaProducto[]), if this Licencia object was restored with
  202. * an ExpandAsArray on the LISTA_PRODUCTO association table.
  203. * @var ListaProducto[] _objListaProductoAsLICENCIAIdLICENCIAArray;
  204. */
  205. private $_objListaProductoAsLICENCIAIdLICENCIAArray = array();
  206. /**
  207. * Private member variable that stores a reference to a single ResponsableAsLICENCIAIdLICENCIA object
  208. * (of type Responsable), if this Licencia object was restored with
  209. * an expansion on the RESPONSABLE association table.
  210. * @var Responsable _objResponsableAsLICENCIAIdLICENCIA;
  211. */
  212. private $_objResponsableAsLICENCIAIdLICENCIA;
  213. /**
  214. * Private member variable that stores a reference to an array of ResponsableAsLICENCIAIdLICENCIA objects
  215. * (of type Responsable[]), if this Licencia object was restored with
  216. * an ExpandAsArray on the RESPONSABLE association table.
  217. * @var Responsable[] _objResponsableAsLICENCIAIdLICENCIAArray;
  218. */
  219. private $_objResponsableAsLICENCIAIdLICENCIAArray = array();
  220. /**
  221. * Private member variable that stores a reference to a single VigenciaDocumentoAsLICENCIAIdLICENCIA object
  222. * (of type VigenciaDocumento), if this Licencia object was restored with
  223. * an expansion on the VIGENCIA_DOCUMENTO association table.
  224. * @var VigenciaDocumento _objVigenciaDocumentoAsLICENCIAIdLICENCIA;
  225. */
  226. private $_objVigenciaDocumentoAsLICENCIAIdLICENCIA;
  227. /**
  228. * Private member variable that stores a reference to an array of VigenciaDocumentoAsLICENCIAIdLICENCIA objects
  229. * (of type VigenciaDocumento[]), if this Licencia object was restored with
  230. * an ExpandAsArray on the VIGENCIA_DOCUMENTO association table.
  231. * @var VigenciaDocumento[] _objVigenciaDocumentoAsLICENCIAIdLICENCIAArray;
  232. */
  233. private $_objVigenciaDocumentoAsLICENCIAIdLICENCIAArray = array();
  234. /**
  235. * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
  236. * columns from the run-time database query result for this object). Used by InstantiateDbRow and
  237. * GetVirtualAttribute.
  238. * @var string[] $__strVirtualAttributeArray
  239. */
  240. protected $__strVirtualAttributeArray = array();
  241. /**
  242. * Protected internal member variable that specifies whether or not this object is Restored from the database.
  243. * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
  244. * @var bool __blnRestored;
  245. */
  246. protected $__blnRestored;
  247. ///////////////////////////////
  248. // PROTECTED MEMBER OBJECTS
  249. ///////////////////////////////
  250. /**
  251. * Protected member variable that contains the object pointed by the reference
  252. * in the database column LICENCIA.EMPRESA_idEMPRESA.
  253. *
  254. * NOTE: Always use the EMPRESAIdEMPRESAObject property getter to correctly retrieve this Empresa object.
  255. * (Because this class implements late binding, this variable reference MAY be null.)
  256. * @var Empresa objEMPRESAIdEMPRESAObject
  257. */
  258. protected $objEMPRESAIdEMPRESAObject;
  259. /**
  260. * Protected member variable that contains the object pointed by the reference
  261. * in the database column LICENCIA.PROVEEDOR_idPROVEEDOR.
  262. *
  263. * NOTE: Always use the PROVEEDORIdPROVEEDORObject property getter to correctly retrieve this Proveedor object.
  264. * (Because this class implements late binding, this variable reference MAY be null.)
  265. * @var Proveedor objPROVEEDORIdPROVEEDORObject
  266. */
  267. protected $objPROVEEDORIdPROVEEDORObject;
  268. /**
  269. * Protected member variable that contains the object pointed by the reference
  270. * in the database column LICENCIA.PROCESO_idPROCESO.
  271. *
  272. * NOTE: Always use the PROCESOIdPROCESOObject property getter to correctly retrieve this Proceso object.
  273. * (Because this class implements late binding, this variable reference MAY be null.)
  274. * @var Proceso objPROCESOIdPROCESOObject
  275. */
  276. protected $objPROCESOIdPROCESOObject;
  277. /**
  278. * Initialize each property with default values from database definition
  279. */
  280. public function Initialize()
  281. {
  282. $this->intIdLICENCIA = Licencia::IdLICENCIADefault;
  283. $this->intEMPRESAIdEMPRESA = Licencia::EMPRESAIdEMPRESADefault;
  284. $this->intPROVEEDORIdPROVEEDOR = Licencia::PROVEEDORIdPROVEEDORDefault;
  285. $this->dttFechaInicio = (Licencia::FechaInicioDefault === null)?null:new QDateTime(Licencia::FechaInicioDefault);
  286. $this->dttFechaFin = (Licencia::FechaFinDefault === null)?null:new QDateTime(Licencia::FechaFinDefault);
  287. $this->dttFechaFinEstimada = (Licencia::FechaFinEstimadaDefault === null)?null:new QDateTime(Licencia::FechaFinEstimadaDefault);
  288. $this->strNumeroProforma = Licencia::NumeroProformaDefault;
  289. $this->strNumeroCNP = Licencia::NumeroCNPDefault;
  290. $this->dttVencimientoCNP = (Licencia::VencimientoCNPDefault === null)?null:new QDateTime(Licencia::VencimientoCNPDefault);
  291. $this->strStatus = Licencia::StatusDefault;
  292. $this->strFormaPago = Licencia::FormaPagoDefault;
  293. $this->strTipo = Licencia::TipoDefault;
  294. $this->fltFlete = Licencia::FleteDefault;
  295. $this->strSeguro = Licencia::SeguroDefault;
  296. $this->intPROCESOIdPROCESO = Licencia::PROCESOIdPROCESODefault;
  297. }
  298. ///////////////////////////////
  299. // CLASS-WIDE LOAD AND COUNT METHODS
  300. ///////////////////////////////
  301. /**
  302. * Static method to retrieve the Database object that owns this class.
  303. * @return QDatabaseBase reference to the Database object that can query this class
  304. */
  305. public static function GetDatabase() {
  306. return QApplication::$Database[1];
  307. }
  308. /**
  309. * Load a Licencia from PK Info
  310. * @param integer $intIdLICENCIA
  311. * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  312. * @return Licencia
  313. */
  314. public static function Load($intIdLICENCIA, $objOptionalClauses = null) {
  315. // Use QuerySingle to Perform the Query
  316. return Licencia::QuerySingle(
  317. QQ::AndCondition(
  318. QQ::Equal(QQN::Licencia()->IdLICENCIA, $intIdLICENCIA)
  319. ),
  320. $objOptionalClauses
  321. );
  322. }
  323. /**
  324. * Load all Licencias
  325. * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  326. * @return Licencia[]
  327. */
  328. public static function LoadAll($objOptionalClauses = null) {
  329. if (func_num_args() > 1) {
  330. throw new QCallerException("LoadAll must be called with an array of optional clauses as a single argument");
  331. }
  332. // Call Licencia::QueryArray to perform the LoadAll query
  333. try {
  334. return Licencia::QueryArray(QQ::All(), $objOptionalClauses);
  335. } catch (QCallerException $objExc) {
  336. $objExc->IncrementOffset();
  337. throw $objExc;
  338. }
  339. }
  340. /**
  341. * Count all Licencias
  342. * @return int
  343. */
  344. public static function CountAll() {
  345. // Call Licencia::QueryCount to perform the CountAll query
  346. return Licencia::QueryCount(QQ::All());
  347. }
  348. ///////////////////////////////
  349. // QCUBED QUERY-RELATED METHODS
  350. ///////////////////////////////
  351. /**
  352. * Internally called method to assist with calling Qcubed Query for this class
  353. * on load methods.
  354. * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
  355. * @param QQCondition $objConditions any conditions on the query, itself
  356. * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
  357. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
  358. * @param boolean $blnCountOnly only select a rowcount
  359. * @return string the query statement
  360. */
  361. protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
  362. // Get the Database Object for this Class
  363. $objDatabase = Licencia::GetDatabase();
  364. // Create/Build out the QueryBuilder object with Licencia-specific SELET and FROM fields
  365. $objQueryBuilder = new QQueryBuilder($objDatabase, 'LICENCIA');
  366. Licencia::GetSelectFields($objQueryBuilder);
  367. $objQueryBuilder->AddFromItem('LICENCIA');
  368. // Set "CountOnly" option (if applicable)
  369. if ($blnCountOnly)
  370. $objQueryBuilder->SetCountOnlyFlag();
  371. // Apply Any Conditions
  372. if ($objConditions)
  373. try {
  374. $objConditions->UpdateQueryBuilder($objQueryBuilder);
  375. } catch (QCallerException $objExc) {
  376. $objExc->IncrementOffset();
  377. throw $objExc;
  378. }
  379. // Iterate through all the Optional Clauses (if any) and perform accordingly
  380. if ($objOptionalClauses) {
  381. if ($objOptionalClauses instanceof QQClause)
  382. $objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
  383. else if (is_array($objOptionalClauses))
  384. foreach ($objOptionalClauses as $objClause)
  385. $objClause->UpdateQueryBuilder($objQueryBuilder);
  386. else
  387. throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
  388. }
  389. // Get the SQL Statement
  390. $strQuery = $objQueryBuilder->GetStatement();
  391. // Prepare the Statement with the Query Parameters (if applicable)
  392. if ($mixParameterArray) {
  393. if (is_array($mixParameterArray)) {
  394. if (count($mixParameterArray))
  395. $strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);
  396. // Ensure that there are no other Unresolved Named Parameters
  397. if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
  398. throw new QCallerException('Unresolved named parameters in the query');
  399. } else
  400. throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
  401. }
  402. // Return the Objects
  403. return $strQuery;
  404. }
  405. /**
  406. * Static Qcubed Query method to query for a single Licencia object.
  407. * Uses BuildQueryStatment to perform most of the work.
  408. * @param QQCondition $objConditions any conditions on the query, itself
  409. * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
  410. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
  411. * @return Licencia the queried object
  412. */
  413. public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
  414. // Get the Query Statement
  415. try {
  416. $strQuery = Licencia::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
  417. } catch (QCallerException $objExc) {
  418. $objExc->IncrementOffset();
  419. throw $objExc;
  420. }
  421. // Perform the Query, Get the First Row, and Instantiate a new Licencia object
  422. $objDbResult = $objQueryBuilder->Database->Query($strQuery);
  423. // Do we have to expand anything?
  424. if ($objQueryBuilder->ExpandAsArrayNodes) {
  425. $objToReturn = array();
  426. while ($objDbRow = $objDbResult->GetNextRow()) {
  427. $objItem = Licencia::InstantiateDbRow($objDbRow, null, $objQueryBuilder->ExpandAsArrayNodes, $objToReturn, $objQueryBuilder->ColumnAliasArray);
  428. if ($objItem)
  429. $objToReturn[] = $objItem;
  430. }
  431. if (count($objToReturn)) {
  432. // Since we only want the object to return, lets return the object and not the array.
  433. return $objToReturn[0];
  434. } else {
  435. return null;
  436. }
  437. } else {
  438. // No expands just return the first row
  439. $objDbRow = $objDbResult->GetNextRow();
  440. if(null === $objDbRow)
  441. return null;
  442. return Licencia::InstantiateDbRow($objDbRow, null, null, null, $objQueryBuilder->ColumnAliasArray);
  443. }
  444. }
  445. /**
  446. * Static Qcubed Query method to query for an array of Licencia objects.
  447. * Uses BuildQueryStatment to perform most of the work.
  448. * @param QQCondition $objConditions any conditions on the query, itself
  449. * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
  450. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
  451. * @return Licencia[] the queried objects as an array
  452. */
  453. public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
  454. // Get the Query Statement
  455. try {
  456. $strQuery = Licencia::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
  457. } catch (QCallerException $objExc) {
  458. $objExc->IncrementOffset();
  459. throw $objExc;
  460. }
  461. // Perform the Query and Instantiate the Array Result
  462. $objDbResult = $objQueryBuilder->Database->Query($strQuery);
  463. return Licencia::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
  464. }
  465. /**
  466. * Static Qcubed Query method to query for a count of Licencia objects.
  467. * Uses BuildQueryStatment to perform most of the work.
  468. * @param QQCondition $objConditions any conditions on the query, itself
  469. * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
  470. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
  471. * @return integer the count of queried objects as an integer
  472. */
  473. public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
  474. // Get the Query Statement
  475. try {
  476. $strQuery = Licencia::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
  477. } catch (QCallerException $objExc) {
  478. $objExc->IncrementOffset();
  479. throw $objExc;
  480. }
  481. // Perform the Query and return the row_count
  482. $objDbResult = $objQueryBuilder->Database->Query($strQuery);
  483. // Figure out if the query is using GroupBy
  484. $blnGrouped = false;
  485. if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
  486. if ($objClause instanceof QQGroupBy) {
  487. $blnGrouped = true;
  488. break;
  489. }
  490. }
  491. if ($blnGrouped)
  492. // Groups in this query - return the count of Groups (which is the count of all rows)
  493. return $objDbResult->CountRows();
  494. else {
  495. // No Groups - return the sql-calculated count(*) value
  496. $strDbRow = $objDbResult->FetchRow();
  497. return QType::Cast($strDbRow[0], QType::Integer);
  498. }
  499. }
  500. public static function QueryArrayCached(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null, $blnForceUpdate = false) {
  501. // Get the Database Object for this Class
  502. $objDatabase = Licencia::GetDatabase();
  503. $strQuery = Licencia::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
  504. $objCache = new QCache('qquery/licencia', $strQuery);
  505. $cacheData = $objCache->GetData();
  506. if (!$cacheData || $blnForceUpdate) {
  507. $objDbResult = $objQueryBuilder->Database->Query($strQuery);
  508. $arrResult = Licencia::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
  509. $objCache->SaveData(serialize($arrResult));
  510. } else {
  511. $arrResult = unserialize($cacheData);
  512. }
  513. return $arrResult;
  514. }
  515. /**
  516. * Updates a QQueryBuilder with the SELECT fields for this Licencia
  517. * @param QQueryBuilder $objBuilder the Query Builder object to update
  518. * @param string $strPrefix optional prefix to add to the SELECT fields
  519. */
  520. public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
  521. if ($strPrefix) {
  522. $strTableName = $strPrefix;
  523. $strAliasPrefix = $strPrefix . '__';
  524. } else {
  525. $strTableName = 'LICENCIA';
  526. $strAliasPrefix = '';
  527. }
  528. $objBuilder->AddSelectItem($strTableName, 'idLICENCIA', $strAliasPrefix . 'idLICENCIA');
  529. $objBuilder->AddSelectItem($strTableName, 'EMPRESA_idEMPRESA', $strAliasPrefix . 'EMPRESA_idEMPRESA');
  530. $objBuilder->AddSelectItem($strTableName, 'PROVEEDOR_idPROVEEDOR', $strAliasPrefix . 'PROVEEDOR_idPROVEEDOR');
  531. $objBuilder->AddSelectItem($strTableName, 'fechaInicio', $strAliasPrefix . 'fechaInicio');
  532. $objBuilder->AddSelectItem($strTableName, 'fechaFin', $strAliasPrefix . 'fechaFin');
  533. $objBuilder->AddSelectItem($strTableName, 'fechaFinEstimada', $strAliasPrefix . 'fechaFinEstimada');
  534. $objBuilder->AddSelectItem($strTableName, 'numeroProforma', $strAliasPrefix . 'numeroProforma');
  535. $objBuilder->AddSelectItem($strTableName, 'numeroCNP', $strAliasPrefix . 'numeroCNP');
  536. $objBuilder->AddSelectItem($strTableName, 'vencimientoCNP', $strAliasPrefix . 'vencimientoCNP');
  537. $objBuilder->AddSelectItem($strTableName, 'status', $strAliasPrefix . 'status');
  538. $objBuilder->AddSelectItem($strTableName, 'formaPago', $strAliasPrefix . 'formaPago');
  539. $objBuilder->AddSelectItem($strTableName, 'tipo', $strAliasPrefix . 'tipo');
  540. $objBuilder->AddSelectItem($strTableName, 'flete', $strAliasPrefix . 'flete');
  541. $objBuilder->AddSelectItem($strTableName, 'seguro', $strAliasPrefix . 'seguro');
  542. $objBuilder->AddSelectItem($strTableName, 'PROCESO_idPROCESO', $strAliasPrefix . 'PROCESO_idPROCESO');
  543. }
  544. ///////////////////////////////
  545. // INSTANTIATION-RELATED METHODS
  546. ///////////////////////////////
  547. /**
  548. * Instantiate a Licencia from a Database Row.
  549. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  550. * is calling this Licencia::InstantiateDbRow in order to perform
  551. * early binding on referenced objects.
  552. * @param DatabaseRowBase $objDbRow
  553. * @param string $strAliasPrefix
  554. * @param string $strExpandAsArrayNodes
  555. * @param QBaseClass $arrPreviousItem
  556. * @param string[] $strColumnAliasArray
  557. * @return Licencia
  558. */
  559. public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array()) {
  560. // If blank row, return null
  561. if (!$objDbRow) {
  562. return null;
  563. }
  564. // See if we're doing an array expansion on the previous item
  565. $strAlias = $strAliasPrefix . 'idLICENCIA';
  566. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  567. if (($strExpandAsArrayNodes) && is_array($arrPreviousItems) && count($arrPreviousItems)) {
  568. foreach ($arrPreviousItems as $objPreviousItem) {
  569. if ($objPreviousItem->intIdLICENCIA == $objDbRow->GetColumn($strAliasName, 'Integer')) {
  570. // We are. Now, prepare to check for ExpandAsArray clauses
  571. $blnExpandedViaArray = false;
  572. if (!$strAliasPrefix)
  573. $strAliasPrefix = 'LICENCIA__';
  574. // Expanding reverse references: CodigoPagoAsLICENCIAIdLICENCIA
  575. $strAlias = $strAliasPrefix . 'codigopagoaslicenciaidlicencia__LICENCIA_idLICENCIA';
  576. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  577. if ((array_key_exists($strAlias, $strExpandAsArrayNodes)) &&
  578. (!is_null($objDbRow->GetColumn($strAliasName)))) {
  579. if ($intPreviousChildItemCount = count($objPreviousItem->_objCodigoPagoAsLICENCIAIdLICENCIAArray)) {
  580. $objPreviousChildItems = $objPreviousItem->_objCodigoPagoAsLICENCIAIdLICENCIAArray;
  581. $objChildItem = CodigoPago::InstantiateDbRow($objDbRow, $strAliasPrefix . 'codigopagoaslicenciaidlicencia__', $strExpandAsArrayNodes, $objPreviousChildItems, $strColumnAliasArray);
  582. if ($objChildItem) {
  583. $objPreviousItem->_objCodigoPagoAsLICENCIAIdLICENCIAArray[] = $objChildItem;
  584. }
  585. } else {
  586. $objPreviousItem->_objCodigoPagoAsLICENCIAIdLICENCIAArray[] = CodigoPago::InstantiateDbRow($objDbRow, $strAliasPrefix . 'codigopagoaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  587. }
  588. $blnExpandedViaArray = true;
  589. }
  590. // Expanding reverse references: FaseLicenciaAsLICENCIAIdLICENCIA
  591. $strAlias = $strAliasPrefix . 'faselicenciaaslicenciaidlicencia__LICENCIA_idLICENCIA';
  592. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  593. if ((array_key_exists($strAlias, $strExpandAsArrayNodes)) &&
  594. (!is_null($objDbRow->GetColumn($strAliasName)))) {
  595. if ($intPreviousChildItemCount = count($objPreviousItem->_objFaseLicenciaAsLICENCIAIdLICENCIAArray)) {
  596. $objPreviousChildItems = $objPreviousItem->_objFaseLicenciaAsLICENCIAIdLICENCIAArray;
  597. $objChildItem = FaseLicencia::InstantiateDbRow($objDbRow, $strAliasPrefix . 'faselicenciaaslicenciaidlicencia__', $strExpandAsArrayNodes, $objPreviousChildItems, $strColumnAliasArray);
  598. if ($objChildItem) {
  599. $objPreviousItem->_objFaseLicenciaAsLICENCIAIdLICENCIAArray[] = $objChildItem;
  600. }
  601. } else {
  602. $objPreviousItem->_objFaseLicenciaAsLICENCIAIdLICENCIAArray[] = FaseLicencia::InstantiateDbRow($objDbRow, $strAliasPrefix . 'faselicenciaaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  603. }
  604. $blnExpandedViaArray = true;
  605. }
  606. // Expanding reverse references: ImportacionAsLICENCIAIdLICENCIA
  607. $strAlias = $strAliasPrefix . 'importacionaslicenciaidlicencia__TRANSPORTE_idTRANSPORTE';
  608. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  609. if ((array_key_exists($strAlias, $strExpandAsArrayNodes)) &&
  610. (!is_null($objDbRow->GetColumn($strAliasName)))) {
  611. if ($intPreviousChildItemCount = count($objPreviousItem->_objImportacionAsLICENCIAIdLICENCIAArray)) {
  612. $objPreviousChildItems = $objPreviousItem->_objImportacionAsLICENCIAIdLICENCIAArray;
  613. $objChildItem = Importacion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'importacionaslicenciaidlicencia__', $strExpandAsArrayNodes, $objPreviousChildItems, $strColumnAliasArray);
  614. if ($objChildItem) {
  615. $objPreviousItem->_objImportacionAsLICENCIAIdLICENCIAArray[] = $objChildItem;
  616. }
  617. } else {
  618. $objPreviousItem->_objImportacionAsLICENCIAIdLICENCIAArray[] = Importacion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'importacionaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  619. }
  620. $blnExpandedViaArray = true;
  621. }
  622. // Expanding reverse references: ListaProductoAsLICENCIAIdLICENCIA
  623. $strAlias = $strAliasPrefix . 'listaproductoaslicenciaidlicencia__LICENCIA_idLICENCIA';
  624. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  625. if ((array_key_exists($strAlias, $strExpandAsArrayNodes)) &&
  626. (!is_null($objDbRow->GetColumn($strAliasName)))) {
  627. if ($intPreviousChildItemCount = count($objPreviousItem->_objListaProductoAsLICENCIAIdLICENCIAArray)) {
  628. $objPreviousChildItems = $objPreviousItem->_objListaProductoAsLICENCIAIdLICENCIAArray;
  629. $objChildItem = ListaProducto::InstantiateDbRow($objDbRow, $strAliasPrefix . 'listaproductoaslicenciaidlicencia__', $strExpandAsArrayNodes, $objPreviousChildItems, $strColumnAliasArray);
  630. if ($objChildItem) {
  631. $objPreviousItem->_objListaProductoAsLICENCIAIdLICENCIAArray[] = $objChildItem;
  632. }
  633. } else {
  634. $objPreviousItem->_objListaProductoAsLICENCIAIdLICENCIAArray[] = ListaProducto::InstantiateDbRow($objDbRow, $strAliasPrefix . 'listaproductoaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  635. }
  636. $blnExpandedViaArray = true;
  637. }
  638. // Expanding reverse references: ResponsableAsLICENCIAIdLICENCIA
  639. $strAlias = $strAliasPrefix . 'responsableaslicenciaidlicencia__EMPLEADO_idEMPLEADO';
  640. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  641. if ((array_key_exists($strAlias, $strExpandAsArrayNodes)) &&
  642. (!is_null($objDbRow->GetColumn($strAliasName)))) {
  643. if ($intPreviousChildItemCount = count($objPreviousItem->_objResponsableAsLICENCIAIdLICENCIAArray)) {
  644. $objPreviousChildItems = $objPreviousItem->_objResponsableAsLICENCIAIdLICENCIAArray;
  645. $objChildItem = Responsable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'responsableaslicenciaidlicencia__', $strExpandAsArrayNodes, $objPreviousChildItems, $strColumnAliasArray);
  646. if ($objChildItem) {
  647. $objPreviousItem->_objResponsableAsLICENCIAIdLICENCIAArray[] = $objChildItem;
  648. }
  649. } else {
  650. $objPreviousItem->_objResponsableAsLICENCIAIdLICENCIAArray[] = Responsable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'responsableaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  651. }
  652. $blnExpandedViaArray = true;
  653. }
  654. // Expanding reverse references: VigenciaDocumentoAsLICENCIAIdLICENCIA
  655. $strAlias = $strAliasPrefix . 'vigenciadocumentoaslicenciaidlicencia__LICENCIA_idLICENCIA';
  656. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  657. if ((array_key_exists($strAlias, $strExpandAsArrayNodes)) &&
  658. (!is_null($objDbRow->GetColumn($strAliasName)))) {
  659. if ($intPreviousChildItemCount = count($objPreviousItem->_objVigenciaDocumentoAsLICENCIAIdLICENCIAArray)) {
  660. $objPreviousChildItems = $objPreviousItem->_objVigenciaDocumentoAsLICENCIAIdLICENCIAArray;
  661. $objChildItem = VigenciaDocumento::InstantiateDbRow($objDbRow, $strAliasPrefix . 'vigenciadocumentoaslicenciaidlicencia__', $strExpandAsArrayNodes, $objPreviousChildItems, $strColumnAliasArray);
  662. if ($objChildItem) {
  663. $objPreviousItem->_objVigenciaDocumentoAsLICENCIAIdLICENCIAArray[] = $objChildItem;
  664. }
  665. } else {
  666. $objPreviousItem->_objVigenciaDocumentoAsLICENCIAIdLICENCIAArray[] = VigenciaDocumento::InstantiateDbRow($objDbRow, $strAliasPrefix . 'vigenciadocumentoaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  667. }
  668. $blnExpandedViaArray = true;
  669. }
  670. // Either return false to signal array expansion, or check-to-reset the Alias prefix and move on
  671. if ($blnExpandedViaArray) {
  672. return false;
  673. } else if ($strAliasPrefix == 'LICENCIA__') {
  674. $strAliasPrefix = null;
  675. }
  676. }
  677. }
  678. }
  679. // Create a new instance of the Licencia object
  680. $objToReturn = new Licencia();
  681. $objToReturn->__blnRestored = true;
  682. $strAliasName = array_key_exists($strAliasPrefix . 'idLICENCIA', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'idLICENCIA'] : $strAliasPrefix . 'idLICENCIA';
  683. $objToReturn->intIdLICENCIA = $objDbRow->GetColumn($strAliasName, 'Integer');
  684. $strAliasName = array_key_exists($strAliasPrefix . 'EMPRESA_idEMPRESA', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'EMPRESA_idEMPRESA'] : $strAliasPrefix . 'EMPRESA_idEMPRESA';
  685. $objToReturn->intEMPRESAIdEMPRESA = $objDbRow->GetColumn($strAliasName, 'Integer');
  686. $strAliasName = array_key_exists($strAliasPrefix . 'PROVEEDOR_idPROVEEDOR', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'PROVEEDOR_idPROVEEDOR'] : $strAliasPrefix . 'PROVEEDOR_idPROVEEDOR';
  687. $objToReturn->intPROVEEDORIdPROVEEDOR = $objDbRow->GetColumn($strAliasName, 'Integer');
  688. $strAliasName = array_key_exists($strAliasPrefix . 'fechaInicio', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'fechaInicio'] : $strAliasPrefix . 'fechaInicio';
  689. $objToReturn->dttFechaInicio = $objDbRow->GetColumn($strAliasName, 'Date');
  690. $strAliasName = array_key_exists($strAliasPrefix . 'fechaFin', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'fechaFin'] : $strAliasPrefix . 'fechaFin';
  691. $objToReturn->dttFechaFin = $objDbRow->GetColumn($strAliasName, 'Date');
  692. $strAliasName = array_key_exists($strAliasPrefix . 'fechaFinEstimada', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'fechaFinEstimada'] : $strAliasPrefix . 'fechaFinEstimada';
  693. $objToReturn->dttFechaFinEstimada = $objDbRow->GetColumn($strAliasName, 'Date');
  694. $strAliasName = array_key_exists($strAliasPrefix . 'numeroProforma', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'numeroProforma'] : $strAliasPrefix . 'numeroProforma';
  695. $objToReturn->strNumeroProforma = $objDbRow->GetColumn($strAliasName, 'VarChar');
  696. $strAliasName = array_key_exists($strAliasPrefix . 'numeroCNP', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'numeroCNP'] : $strAliasPrefix . 'numeroCNP';
  697. $objToReturn->strNumeroCNP = $objDbRow->GetColumn($strAliasName, 'VarChar');
  698. $strAliasName = array_key_exists($strAliasPrefix . 'vencimientoCNP', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'vencimientoCNP'] : $strAliasPrefix . 'vencimientoCNP';
  699. $objToReturn->dttVencimientoCNP = $objDbRow->GetColumn($strAliasName, 'Date');
  700. $strAliasName = array_key_exists($strAliasPrefix . 'status', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'status'] : $strAliasPrefix . 'status';
  701. $objToReturn->strStatus = $objDbRow->GetColumn($strAliasName, 'VarChar');
  702. $strAliasName = array_key_exists($strAliasPrefix . 'formaPago', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'formaPago'] : $strAliasPrefix . 'formaPago';
  703. $objToReturn->strFormaPago = $objDbRow->GetColumn($strAliasName, 'VarChar');
  704. $strAliasName = array_key_exists($strAliasPrefix . 'tipo', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'tipo'] : $strAliasPrefix . 'tipo';
  705. $objToReturn->strTipo = $objDbRow->GetColumn($strAliasName, 'VarChar');
  706. $strAliasName = array_key_exists($strAliasPrefix . 'flete', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'flete'] : $strAliasPrefix . 'flete';
  707. $objToReturn->fltFlete = $objDbRow->GetColumn($strAliasName, 'Float');
  708. $strAliasName = array_key_exists($strAliasPrefix . 'seguro', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'seguro'] : $strAliasPrefix . 'seguro';
  709. $objToReturn->strSeguro = $objDbRow->GetColumn($strAliasName, 'VarChar');
  710. $strAliasName = array_key_exists($strAliasPrefix . 'PROCESO_idPROCESO', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'PROCESO_idPROCESO'] : $strAliasPrefix . 'PROCESO_idPROCESO';
  711. $objToReturn->intPROCESOIdPROCESO = $objDbRow->GetColumn($strAliasName, 'Integer');
  712. if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
  713. foreach ($arrPreviousItems as $objPreviousItem) {
  714. if ($objToReturn->IdLICENCIA != $objPreviousItem->IdLICENCIA) {
  715. continue;
  716. }
  717. if (array_diff($objPreviousItem->_objCodigoPagoAsLICENCIAIdLICENCIAArray, $objToReturn->_objCodigoPagoAsLICENCIAIdLICENCIAArray) != null) {
  718. continue;
  719. }
  720. if (array_diff($objPreviousItem->_objFaseLicenciaAsLICENCIAIdLICENCIAArray, $objToReturn->_objFaseLicenciaAsLICENCIAIdLICENCIAArray) != null) {
  721. continue;
  722. }
  723. if (array_diff($objPreviousItem->_objImportacionAsLICENCIAIdLICENCIAArray, $objToReturn->_objImportacionAsLICENCIAIdLICENCIAArray) != null) {
  724. continue;
  725. }
  726. if (array_diff($objPreviousItem->_objListaProductoAsLICENCIAIdLICENCIAArray, $objToReturn->_objListaProductoAsLICENCIAIdLICENCIAArray) != null) {
  727. continue;
  728. }
  729. if (array_diff($objPreviousItem->_objResponsableAsLICENCIAIdLICENCIAArray, $objToReturn->_objResponsableAsLICENCIAIdLICENCIAArray) != null) {
  730. continue;
  731. }
  732. if (array_diff($objPreviousItem->_objVigenciaDocumentoAsLICENCIAIdLICENCIAArray, $objToReturn->_objVigenciaDocumentoAsLICENCIAIdLICENCIAArray) != null) {
  733. continue;
  734. }
  735. // complete match - all primary key columns are the same
  736. return null;
  737. }
  738. }
  739. // Instantiate Virtual Attributes
  740. foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
  741. $strVirtualPrefix = $strAliasPrefix . '__';
  742. $strVirtualPrefixLength = strlen($strVirtualPrefix);
  743. if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
  744. $objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
  745. }
  746. // Prepare to Check for Early/Virtual Binding
  747. if (!$strAliasPrefix)
  748. $strAliasPrefix = 'LICENCIA__';
  749. // Check for EMPRESAIdEMPRESAObject Early Binding
  750. $strAlias = $strAliasPrefix . 'EMPRESA_idEMPRESA__idEMPRESA';
  751. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  752. if (!is_null($objDbRow->GetColumn($strAliasName)))
  753. $objToReturn->objEMPRESAIdEMPRESAObject = Empresa::InstantiateDbRow($objDbRow, $strAliasPrefix . 'EMPRESA_idEMPRESA__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  754. // Check for PROVEEDORIdPROVEEDORObject Early Binding
  755. $strAlias = $strAliasPrefix . 'PROVEEDOR_idPROVEEDOR__idPROVEEDOR';
  756. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  757. if (!is_null($objDbRow->GetColumn($strAliasName)))
  758. $objToReturn->objPROVEEDORIdPROVEEDORObject = Proveedor::InstantiateDbRow($objDbRow, $strAliasPrefix . 'PROVEEDOR_idPROVEEDOR__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  759. // Check for PROCESOIdPROCESOObject Early Binding
  760. $strAlias = $strAliasPrefix . 'PROCESO_idPROCESO__idPROCESO';
  761. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  762. if (!is_null($objDbRow->GetColumn($strAliasName)))
  763. $objToReturn->objPROCESOIdPROCESOObject = Proceso::InstantiateDbRow($objDbRow, $strAliasPrefix . 'PROCESO_idPROCESO__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  764. // Check for CodigoPagoAsLICENCIAIdLICENCIA Virtual Binding
  765. $strAlias = $strAliasPrefix . 'codigopagoaslicenciaidlicencia__LICENCIA_idLICENCIA';
  766. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  767. if (!is_null($objDbRow->GetColumn($strAliasName))) {
  768. if (($strExpandAsArrayNodes) && (array_key_exists($strAlias, $strExpandAsArrayNodes)))
  769. $objToReturn->_objCodigoPagoAsLICENCIAIdLICENCIAArray[] = CodigoPago::InstantiateDbRow($objDbRow, $strAliasPrefix . 'codigopagoaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  770. else
  771. $objToReturn->_objCodigoPagoAsLICENCIAIdLICENCIA = CodigoPago::InstantiateDbRow($objDbRow, $strAliasPrefix . 'codigopagoaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  772. }
  773. // Check for FaseLicenciaAsLICENCIAIdLICENCIA Virtual Binding
  774. $strAlias = $strAliasPrefix . 'faselicenciaaslicenciaidlicencia__LICENCIA_idLICENCIA';
  775. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  776. if (!is_null($objDbRow->GetColumn($strAliasName))) {
  777. if (($strExpandAsArrayNodes) && (array_key_exists($strAlias, $strExpandAsArrayNodes)))
  778. $objToReturn->_objFaseLicenciaAsLICENCIAIdLICENCIAArray[] = FaseLicencia::InstantiateDbRow($objDbRow, $strAliasPrefix . 'faselicenciaaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  779. else
  780. $objToReturn->_objFaseLicenciaAsLICENCIAIdLICENCIA = FaseLicencia::InstantiateDbRow($objDbRow, $strAliasPrefix . 'faselicenciaaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  781. }
  782. // Check for ImportacionAsLICENCIAIdLICENCIA Virtual Binding
  783. $strAlias = $strAliasPrefix . 'importacionaslicenciaidlicencia__TRANSPORTE_idTRANSPORTE';
  784. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  785. if (!is_null($objDbRow->GetColumn($strAliasName))) {
  786. if (($strExpandAsArrayNodes) && (array_key_exists($strAlias, $strExpandAsArrayNodes)))
  787. $objToReturn->_objImportacionAsLICENCIAIdLICENCIAArray[] = Importacion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'importacionaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  788. else
  789. $objToReturn->_objImportacionAsLICENCIAIdLICENCIA = Importacion::InstantiateDbRow($objDbRow, $strAliasPrefix . 'importacionaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  790. }
  791. // Check for ListaProductoAsLICENCIAIdLICENCIA Virtual Binding
  792. $strAlias = $strAliasPrefix . 'listaproductoaslicenciaidlicencia__LICENCIA_idLICENCIA';
  793. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  794. if (!is_null($objDbRow->GetColumn($strAliasName))) {
  795. if (($strExpandAsArrayNodes) && (array_key_exists($strAlias, $strExpandAsArrayNodes)))
  796. $objToReturn->_objListaProductoAsLICENCIAIdLICENCIAArray[] = ListaProducto::InstantiateDbRow($objDbRow, $strAliasPrefix . 'listaproductoaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  797. else
  798. $objToReturn->_objListaProductoAsLICENCIAIdLICENCIA = ListaProducto::InstantiateDbRow($objDbRow, $strAliasPrefix . 'listaproductoaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  799. }
  800. // Check for ResponsableAsLICENCIAIdLICENCIA Virtual Binding
  801. $strAlias = $strAliasPrefix . 'responsableaslicenciaidlicencia__EMPLEADO_idEMPLEADO';
  802. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  803. if (!is_null($objDbRow->GetColumn($strAliasName))) {
  804. if (($strExpandAsArrayNodes) && (array_key_exists($strAlias, $strExpandAsArrayNodes)))
  805. $objToReturn->_objResponsableAsLICENCIAIdLICENCIAArray[] = Responsable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'responsableaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  806. else
  807. $objToReturn->_objResponsableAsLICENCIAIdLICENCIA = Responsable::InstantiateDbRow($objDbRow, $strAliasPrefix . 'responsableaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  808. }
  809. // Check for VigenciaDocumentoAsLICENCIAIdLICENCIA Virtual Binding
  810. $strAlias = $strAliasPrefix . 'vigenciadocumentoaslicenciaidlicencia__LICENCIA_idLICENCIA';
  811. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  812. if (!is_null($objDbRow->GetColumn($strAliasName))) {
  813. if (($strExpandAsArrayNodes) && (array_key_exists($strAlias, $strExpandAsArrayNodes)))
  814. $objToReturn->_objVigenciaDocumentoAsLICENCIAIdLICENCIAArray[] = VigenciaDocumento::InstantiateDbRow($objDbRow, $strAliasPrefix . 'vigenciadocumentoaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  815. else
  816. $objToReturn->_objVigenciaDocumentoAsLICENCIAIdLICENCIA = VigenciaDocumento::InstantiateDbRow($objDbRow, $strAliasPrefix . 'vigenciadocumentoaslicenciaidlicencia__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  817. }
  818. return $objToReturn;
  819. }
  820. /**
  821. * Instantiate an array of Licencias from a Database Result
  822. * @param DatabaseResultBase $objDbResult
  823. * @param string $strExpandAsArrayNodes
  824. * @param string[] $strColumnAliasArray
  825. * @return Licencia[]
  826. */
  827. public static function Insta

Large files files are truncated, but you can click here to view the full file