Exemplo n.º 1
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return    array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['Cliente'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Cliente'][$this->getPrimaryKey()] = true;
     $keys = ClientePeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getIdClie(), $keys[1] => $this->getApellido(), $keys[2] => $this->getNombre(), $keys[3] => $this->getTelefono(), $keys[4] => $this->getDireccion(), $keys[5] => $this->getIdProv(), $keys[6] => $this->getIdCiudad(), $keys[7] => $this->getEmail(), $keys[8] => $this->getUser(), $keys[9] => $this->getPass());
     if ($includeForeignObjects) {
         if (null !== $this->aCiudadRelatedByIdProv) {
             $result['CiudadRelatedByIdProv'] = $this->aCiudadRelatedByIdProv->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aCiudadRelatedByIdCiudad) {
             $result['CiudadRelatedByIdCiudad'] = $this->aCiudadRelatedByIdCiudad->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collVentas) {
             $result['Ventas'] = $this->collVentas->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return    array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['Empleado'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Empleado'][$this->getPrimaryKey()] = true;
     $keys = EmpleadoPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getIdEmp(), $keys[1] => $this->getApellido(), $keys[2] => $this->getNombre(), $keys[3] => $this->getUser(), $keys[4] => $this->getPass(), $keys[5] => $this->getMail(), $keys[6] => $this->getIdCiudad(), $keys[7] => $this->getIdProv(), $keys[8] => $this->getIdprivilegio(), $keys[9] => $this->getHabilitado());
     if ($includeForeignObjects) {
         if (null !== $this->aCiudadRelatedByIdCiudad) {
             $result['CiudadRelatedByIdCiudad'] = $this->aCiudadRelatedByIdCiudad->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aCiudadRelatedByIdProv) {
             $result['CiudadRelatedByIdProv'] = $this->aCiudadRelatedByIdProv->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aPrivilegios) {
             $result['Privilegios'] = $this->aPrivilegios->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }