Précédent   Forum des professionnels en informatique > PHP > Outils > Zend > Zend Framework > Zend_Db
Zend_Db Forum d'entraide pour le composant Zend_Db du Zend Framework (création de requêtes, abstraction, ORM etc.). Avant de poster -> FAQ Zend_Db.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 09/06/2011, 16h24   #1
Invité régulier
 
Homme Damien
Etudiant
Inscription : juillet 2008
Messages : 37
Détails du profil
Informations personnelles :
Nom : Homme Damien
Localisation : France

Informations professionnelles :
Activité : Etudiant

Informations forums :
Inscription : juillet 2008
Messages : 37
Points : 9
Points : 9
Par défaut ->find() sur SQL Server

Bonjour,

je fais face a un petit probleme :

quand je fais un var_dump de mon objet apres un ->find($id); je me retourve avec un objet bizarre de l'espace au lieux de m'on occurence.

une idée?

merci d'avance.

Code :
1
2
3
4
5
6
 
$id = $this->_getParam('id');   
 
        $q = new Questions();
        $q->find($id);
        var_dump($q);
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
 
object(Questions)[51]
  protected '_tableInstance' => null
  protected '_definition' => null
  protected '_definitionConfigName' => null
  protected '_db' => 
    object(Zend_Db_Adapter_Sqlsrv)[8]
      protected '_config' => 
        array
          'dbname' => string '*******' (length=11)
          'username' => string '****' (length=5)
          'password' => string '****' (length=6)
          'adapter' => string 'sqlsrv' (length=6)
          'host' => string '********' (length=19)
          'charset' => null
          'persistent' => boolean false
          'options' => 
            array
              ...
          'driver_options' => 
            array
              ...
      protected '_lastInsertId' => null
      protected '_lastInsertSQL' => string 'SELECT SCOPE_IDENTITY() as Current_Identity' (length=43)
      protected '_numericDataTypes' => 
        array
          0 => int 0
          1 => int 1
          2 => int 2
          'INT' => int 0
          'SMALLINT' => int 0
          'TINYINT' => int 0
          'BIGINT' => int 1
          'DECIMAL' => int 2
          'FLOAT' => int 2
          'MONEY' => int 2
          'NUMERIC' => int 2
          'REAL' => int 2
          'SMALLMONEY' => int 2
      protected '_defaultStmtClass' => string 'Zend_Db_Statement_Sqlsrv' (length=24)
      protected '_fetchMode' => int 2
      protected '_profiler' => 
        object(Zend_Db_Profiler)[9]
          protected '_queryProfiles' => 
            array
              ...
          protected '_enabled' => boolean true
          protected '_filterElapsedSecs' => null
          protected '_filterTypes' => null
      protected '_defaultProfilerClass' => string 'Zend_Db_Profiler' (length=16)
      protected '_connection' => resource(78, SQL Server Connection)
      protected '_caseFolding' => int 0
      protected '_autoQuoteIdentifiers' => boolean true
      protected '_allowSerialization' => boolean true
      protected '_autoReconnectOnUnserialize' => boolean false
  protected '_schema' => null
  protected '_name' => string 'questions' (length=9)
  protected '_cols' => 
    array
      0 => string 'id' (length=2)
      1 => string 'subject' (length=7)
      2 => string 'id_user' (length=7)
      3 => string 'state' (length=5)
  protected '_primary' => 
    array
      1 => string 'id' (length=2)
  protected '_identity' => int 1
  protected '_sequence' => boolean true
  protected '_metadata' => 
    array
      'id' => 
        array
          'SCHEMA_NAME' => null
          'TABLE_NAME' => string 'questions' (length=9)
          'COLUMN_NAME' => string 'id' (length=2)
          'COLUMN_POSITION' => int 1
          'DATA_TYPE' => string 'int' (length=3)
          'DEFAULT' => null
          'NULLABLE' => boolean false
          'LENGTH' => int 4
          'SCALE' => int 0
          'PRECISION' => int 10
          'UNSIGNED' => null
          'PRIMARY' => boolean true
          'PRIMARY_POSITION' => int 1
          'IDENTITY' => boolean true
      'subject' => 
        array
          'SCHEMA_NAME' => null
          'TABLE_NAME' => string 'questions' (length=9)
          'COLUMN_NAME' => string 'subject' (length=7)
          'COLUMN_POSITION' => int 2
          'DATA_TYPE' => string 'text' (length=4)
          'DEFAULT' => null
          'NULLABLE' => boolean false
          'LENGTH' => int 2147483647
          'SCALE' => null
          'PRECISION' => int 2147483647
          'UNSIGNED' => null
          'PRIMARY' => boolean false
          'PRIMARY_POSITION' => null
          'IDENTITY' => boolean false
      'id_user' => 
        array
          'SCHEMA_NAME' => null
          'TABLE_NAME' => string 'questions' (length=9)
          'COLUMN_NAME' => string 'id_user' (length=7)
          'COLUMN_POSITION' => int 3
          'DATA_TYPE' => string 'int' (length=3)
          'DEFAULT' => null
          'NULLABLE' => boolean false
          'LENGTH' => int 4
          'SCALE' => int 0
          'PRECISION' => int 10
          'UNSIGNED' => null
          'PRIMARY' => boolean false
          'PRIMARY_POSITION' => null
          'IDENTITY' => boolean false
      'state' => 
        array
          'SCHEMA_NAME' => null
          'TABLE_NAME' => string 'questions' (length=9)
          'COLUMN_NAME' => string 'state' (length=5)
          'COLUMN_POSITION' => int 4
          'DATA_TYPE' => string 'int' (length=3)
          'DEFAULT' => null
          'NULLABLE' => boolean false
          'LENGTH' => int 4
          'SCALE' => int 0
          'PRECISION' => int 10
          'UNSIGNED' => null
          'PRIMARY' => boolean false
          'PRIMARY_POSITION' => null
          'IDENTITY' => boolean false
  protected '_metadataCache' => null
  protected '_metadataCacheInClass' => boolean true
  protected '_rowClass' => string 'Zend_Db_Table_Row' (length=17)
  protected '_rowsetClass' => string 'Zend_Db_Table_Rowset' (length=20)
  protected '_referenceMap' => 
    array
      empty
  protected '_dependentTables' => 
    array
      empty
  protected '_defaultSource' => string 'defaultNone' (length=11)
  protected '_defaultValues' => 
    array
      empty
madd63 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/06/2011, 16h28   #2
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
c'est normale ...

Code :
1
2
$r = $q->find($id);
var_dump($r);
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/06/2011, 16h32   #3
Invité régulier
 
Homme Damien
Etudiant
Inscription : juillet 2008
Messages : 37
Détails du profil
Informations personnelles :
Nom : Homme Damien
Localisation : France

Informations professionnelles :
Activité : Etudiant

Informations forums :
Inscription : juillet 2008
Messages : 37
Points : 9
Points : 9
euh, j'ai jamais fais comme ca pour loader un objet

de plus, quand j'affecte le find dans une variable, celle-ci est un boolean ( et egal a false )

merci d'avance
madd63 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/06/2011, 16h37   #4
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
Question et de quelle classe ? Zend_Db_Table ?

je vois vraiment pas comment tu faisais avant ...

http://framework.zend.com/manual/fr/....db.table.find
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/06/2011, 16h37   #5
Invité régulier
 
Homme Damien
Etudiant
Inscription : juillet 2008
Messages : 37
Détails du profil
Informations personnelles :
Nom : Homme Damien
Localisation : France

Informations professionnelles :
Activité : Etudiant

Informations forums :
Inscription : juillet 2008
Messages : 37
Points : 9
Points : 9
Questions extends core_table extends Zend_Db_Table_Abstract
madd63 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/06/2011, 16h38   #6
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
Citation:
Envoyé par madd63 Voir le message
Questions extends core_table extends Zend_Db_Table_Abstract
donc c'est bien comme je t'ai monté : cf message plus haut
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/06/2011, 16h41   #7
Invité régulier
 
Homme Damien
Etudiant
Inscription : juillet 2008
Messages : 37
Détails du profil
Informations personnelles :
Nom : Homme Damien
Localisation : France

Informations professionnelles :
Activité : Etudiant

Informations forums :
Inscription : juillet 2008
Messages : 37
Points : 9
Points : 9
quand je fais ca me donne :
Code :
1
2
3
4
5
6
 
$id = $this->_getParam('id');   
 
        $q = new Questions();
        $r = $q->find($id);
        var_dump($r);
madd63 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/06/2011, 16h47   #8
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
find retourne false si le résultat n'est pas trouver, vérifie ta valeur de $id
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 15h59.


 
 
 
 
Partenaires

Hébergement Web