PHP - clases .. Trying to get property of non-object

 
Vista:
sin imagen de perfil

clases .. Trying to get property of non-object

Publicado por Angel (13 intervenciones) el 23/11/2014 22:31:53
Que tal mi estimados amigos de la LWP necesito algun consejo de uds, ya que tengo un archivo clase Articulos donde me esta marcando el siguiente ' Trying to get property of non-object ' segun he definido ya mis objetos y en el contructor reiniciados ya, pero aun asi me sigue marcando...

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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
class Articulos {
    //put your code her
    //private $idArticulo;
 
    private $descripcion;
    private $idLinea;
    private $idUbicacion;
    private $fabricante;
    private $idImpuesto;
    private $unidad;
    private $imagen;
    private $informacion;
    private $fechaAlta;
    private $usuarioAlta;
    private $idTipoArticulo;
    private $inventario;
    private $referencia;
 
    function __construct($descripcion="", $idLinea='', $idUbicacion='', $fabricante="", $idImpuesto='', $unidad="", $imagen="", $informacion="", $fechaAlta="", $usuarioAlta="", $idTipoArticulo='', $inventario='', $referencia="") {
        $this->descripcion = $descripcion;
        $this->idLinea = $idLinea;
        $this->idUbicacion = $idUbicacion;
        $this->fabricante = $fabricante;
        $this->idImpuesto = $idImpuesto;
        $this->unidad = $unidad;
        $this->imagen = $imagen;
        $this->informacion = $informacion;
        $this->fechaAlta = $fechaAlta;
        $this->usuarioAlta = $usuarioAlta;
        $this->idTipoArticulo = $idTipoArticulo;
        $this->inventario = $inventario;
        $this->referencia = $referencia;
    }
 
    public function fromJSON($json){
    $oj = json_decode($json);
    //   $this->idArticulo = $oj->idArticulo;
        /* @var $oj type */
        $this->descripcion = $oj->descripcion;
        $this->idLinea =     $oj->idLinea;
        $this->idUbicacion = $oj->idUbicacion;
        $this->fabricante =  $oj->fabricante;
        $this->idImpuesto =  $oj->idImpuesto;
        $this->unidad =      $oj->unidad;
        $this->imagen =      $oj->imagen;
        $this->informacion = $oj->informacion;
        $this->fechaAlta =    $oj->fechaAlta;
        $this->usuarioAlta = $oj->usuarioAlta;
        $this->idTipoArticulo = $oj->idTipoArticulo;
        $this->inventario = $oj->inventario;
        $this->referencia = $oj->referencia;
}
/*public function getIdArticulo() {
    return $this->idArticulo;
}
*/
public function getReferencia() {
    return $this->referencia;
}
 
public function getDescripcion() {
    return $this->descripcion;
}
 
public function getIdLinea() {
    return $this->idLinea;
}
 
public function getIdUbicacion() {
    return $this->idUbicacion;
}
 
public function getFabricante() {
    return $this->fabricante;
}
 
public function getIdImpuesto() {
    return $this->idImpuesto;
}
 
public function getUnidad() {
    return $this->unidad;
}
 
public function getImagen() {
    return $this->imagen;
}
 
public function getInformacion() {
    return $this->informacion;
}
 
public function getFechaAlta() {
    return $this->fechaAlta;
}
 
public function getUsuarioAlta() {
    return $this->usuarioAlta;
}
 
public function getIdTipoArticulo() {
    return $this->idTipoArticulo;
}
/*
public function setIdArticulo($idArticulo) {
    $this->idArticulo = $idArticulo;
}
*/
public function setReferencia($referencia) {
    $this->referencia = $referencia;
}
 
public function setDescripcion($descripcion) {
    $this->descripcion = $descripcion;
}
 
public function setIdLinea($idLinea) {
    $this->idlinea = $idLinea;
}
 
public function setIdUbicacion($idUbicacion) {
    $this->idUbicacion = $idUbicacion;
}
 
public function setFabricante($fabricante) {
    $this->fabricante = $fabricante;
}
 
public function setIdImpuesto($idImpuesto) {
    $this->idImpuesto = $idImpuesto;
}
 
public function setUnidad($unidad) {
    $this->unidad = $unidad;
}
 
public function setImagen($imagen) {
    $this->imagen = $imagen;
}
 
public function setInformacion($informacion) {
    $this->informacion = $informacion;
}
 
public function setFechaAlta($fechaAlta) {
    $this->fechaAlta = $fechaAlta;
}
 
public function setUsuarioAlta($usuarioAlta) {
    $this->usuarioAlta = $usuarioAlta;
}
 
public function setIdTipoArticulo($idTipoArticulo) {
    $this->idTipoArticulo = $idTipoArticulo;
}
 
public function getInventario() {
    return $this->inventario;
}
 
public function setInventario($inventario) {
    $this->inventario = $inventario;
}
 
 
   /* public function toJSON(){
       return '{"idCategoria":"'+$this->idCategoria+'","descripcion":"'+$this->descripcion()+'"}';
    }
*/
}

este es mi codigo clase Articulos, espero que me puedan ayudar...
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 3.943
Oro
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

clases .. Trying to get property of non-object

Publicado por xve (6935 intervenciones) el 24/11/2014 08:00:02
Hola Angel, tu clase, la he inicializado y funciona perfectamente... cuando te da el error, o en que linea?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

clases .. Trying to get property of non-object

Publicado por angel (13 intervenciones) el 24/11/2014 18:19:05
Que tal xve, antes que nada te agradezco por contestar
Me marcaba ese error en el log de mi server, pero ya lo rebice bien bien y era por escribir mal un método en el modelo.. Pero ya quedo amigo gracias :)
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de xve
Val: 3.943
Oro
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

clases .. Trying to get property of non-object

Publicado por xve (6935 intervenciones) el 24/11/2014 19:10:41
Gracias por comentarlo!!!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar