Google Mail Kalender Text & Tabellen Reader Web Mehr »
Kürzlich besuchte Gruppen | Hilfe | Anmelden
Google Groups-Startseite
Session array keys not working
Gegenwärtig gibt es mehrere Themen in dieser Gruppe, die zuerst angezeigt werden sollen. Damit dieses Thema zuerst angezeigt werden kann, muss diese Option bei einem anderen Thema entfernt werden.
Bei der Bearbeitung Ihrer Anfrage ist ein Fehler aufgetreten. Versuchen Sie es erneut.
Kennzeichnen
  1 Nachricht - Alle ausblenden  -  Alles übersetzen in die Sprache: Übersetzt (alle Originale anzeigen)
Bei der Gruppe, für die Sie eine Mitteilung verfassen, handelt es sich um eine Usenet-Gruppe. Wenn Sie in dieser Gruppe Nachrichten posten, ist Ihre E-Mail-Adresse für jeden im Internet sichtbar
Ihre Antwort wurde nicht gesendet.
Die Nachricht wurde übermittelt.
 
Von:
An:
Cc:
Nachtrag zu:
Cc hinzufügen | Nachtrag hinzufügen zu | Betreff bearbeiten
Betreff:
Bestätigung:
Geben Sie zur Bestätigung die im folgenden Bild angezeigten Zeichen oder die durchgesagten Zahlen ein, indem Sie auf das Eingabesymbol klicken. Hören Sie zu und geben Sie die gehörten Zahlen ein
 
RhythmicDevil  
Profil anzeigen   Übersetzen in die Sprache: Übersetzt (Original anzeigen)
 Weitere Optionen 20 Nov. 2009, 20:53
Von: RhythmicDevil <rhythmicde...@gmail.com>
Datum: Fri, 20 Nov 2009 11:53:15 -0800 (PST)
Lokal: Fr. 20 Nov. 2009 20:53
Betreff: Session array keys not working
I am having an issue setting data to Session. I have an array in
Session:

Devices.Staging

I want to add a device to the array using the device_id as a key. I
expect something similar to the following:

Devices.Staging.12345678901 = device
Devices.Staging.12345678902 = device

The problem is that my device_id dont seem to work with Session. I am
99% sure its because the ids start with numerals. Because device_ids
that start with an alpha character work without any problems. In
addition if I append an alpha char to the numeric ID it works.

I dont understand why this would be. I am using the device_id as a
string. I have opened up the session.php file and verified that its a
string.

$this->Session->write("Devices.Staging.$device_id",
$query_device_response->queryDeviceRsp);

Another mystery is that the key is replaced by another string of
digits. I dont know where or how this string is generated but its the
same every time.

The following method takes an array of device_id and iterates through
it. On each iteration it will attempt to pull back the device record
from the API. Then it will add the device id and device record as a
key and value respectively to Devices.Staging

        public function add_devices_to_staging()
        {
                Logger::write($this->params['form']['device_ids']);
                foreach($this->params['form']['device_ids'] as $device_id)
                {
                        $query_device_response = $this->TriadApi->QueryDevice($device_id);
                        $this->Session->write("Devices.Staging.$device_id",
$query_device_response->queryDeviceRsp);
                }

                Logger::write($this->Session->read('Devices'));
                $response['status'] = 'success';
                $this->set('response', json_encode($response) );
                $this->render('/elements/ajax_response', 'ajax');
        }

As I said previously this only an issue of the key starts with
numbers. Here is the log output. Notice the array of device_ids and
the last device is the only one in Devices.Staging which means that
the mystery key '2147483647' is being used over and over.

2009-11-20 14:34:36 : Array
(
    [0] => 123456789010
    [1] => 123456789011
    [2] => 123456789013
    [3] => 123456789017
)

2009-11-20 14:34:36 : Array
(
    [Staging] => Array
        (
            [2147483647] => stdClass Object
                (
                    [DeviceId] => 123456789017
                    [DeviceBasics] => stdClass Object
                        (
                            [DeviceType] => SA Explorer
                            [DeviceModel] => Explorer 8300HD MR
                            [DeviceStatus] => Stock
                            [UnitAddress] =>
                            [HostId] =>
                            [SecurityData] =>
                            [CustomFieldList] => stdClass Object
                                (
                                    [CustomField] => Array
                                        (
                                            [0] => stdClass Object
                                                (
                                                    [FieldLabel] => SA
Model
                                                    [FieldValue] =>
                                                )

                                            [1] => stdClass Object
                                                (
                                                    [FieldLabel] =>
Room Location
                                                    [FieldValue] =>
Undefined
                                                )

                                        )

                                )

                        )

                    [Location] => stdClass Object
                        (
                            [LocationId] => HEADEND 01 INVENTORY
                            [HeadendCode] => 01
                            [NetLocCode] =>
                            [Address1] =>
                            [Address2] =>
                            [City] =>
                            [State] =>
                            [Zip] =>
                            [CustomFieldList] => stdClass Object
                                (
                                    [CustomField] => Array
                                        (
                                            [0] => stdClass Object
                                                (
                                                    [FieldLabel] =>
Drop Type
                                                    [FieldValue] =>
                                                )

                                            [1] => stdClass Object
                                                (
                                                    [FieldLabel] =>
Number of Outlets
                                                    [FieldValue] =>
                                                )

                                            [2] => stdClass Object
                                                (
                                                    [FieldLabel] =>
Location Type
                                                    [FieldValue] =>
                                                )

                                        )

                                )

                        )

                )

        )

)


    Weiterleiten  
Sie müssen sich anmelden, bevor Sie Nachrichten veröffentlichen können.
Bevor Sie eine Nachricht posten können, müssen Sie zunächst dieser Gruppe beitreten.
Bitte aktualisieren Sie vor dem Posten in den Abonnementeinstellungen Ihren Spitznamen.
Sie haben nicht die erforderliche Berechtigung zum Posten.
Ende der Nachrichten
« Zurück zu Diskussionen « Neueres Thema     Älteres Thema »

Eine Gruppe erstellen - Google Groups - Google-Startseite - Nutzungsbedingungen - Datenschutzbestimmungen
©2010 Google