Groups
Groups
Sign in
Groups
Groups
KumbiaPHP Framework
Conversations
About
Send feedback
Help
Error en save() para un campo fecha de postgres con default current_date
29 views
Skip to first unread message
Carlos Beltran
unread,
Mar 26, 2012, 9:58:40 PM
3/26/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to KumbiaPHP Framework
Felicitaciones a los desarrolladores por su gran trabajo.
He venido utilizando esta herramienta y hasta ahora me encuentro con
el siguiente error:
En una tabla postgres con un atributo:
fecha date NOT NULL DEFAULT CURRENT_DATE,
en:
$tabla = Load::model('tabla');
...
$tabla->save();
aperece: Error: El campo fecha no puede ser nulo
Es decir no asume el default.
Si embargo hice el insert manual y sí funciona.
Gracias de antemano por la atención.
Carlos Beltran
unread,
Mar 26, 2012, 11:00:06 PM
3/26/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to KumbiaPHP Framework
Bueno como opción al inconveniente, en el modelo creé una función
put...
y con $this->sql("INSERT INTO ...
Si funciona y resuelve el DEFAULT CURRENT_DATE.
Espero que esto ayude en la revisión y futura solución.
Gracias.
emilio.rst
unread,
Mar 27, 2012, 10:22:02 AM
3/27/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to KumbiaPHP Framework
ActiveRecord no reconoce los campos con valores predeterminados, debes
indicarlo con el atributo $_with_default.
Ejemplo:
class Post extends ActiveRecord
{
protected $_with_default = array('fecha');
}
Carlos Beltran
unread,
Mar 27, 2012, 12:02:55 PM
3/27/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to kum...@googlegroups.com
Emilio.
Muy amable por la pronta respuesta y gracias por la solución.
Gran y oportuna ayuda. Adelante!
Reply all
Reply to author
Forward
0 new messages