[symfony-users] Re: Timestampable
You can override the isModified() method on the object to introduce that custom logic. Currently it returns whether any field has been modified. You can change it to return false if only the view field has been modified. Daniel On Jul 31, 6:13 pm, comb sa...@gmx.net wrote: Well I need the updated_at field if some other fields are updated. Only the views-field should not generate a change of the updated_at.. On Jul 30, 4:08 pm, Aldaron frala...@gmail.com wrote: If you don't need to auto update this field then you should not use timestampable.. Try to set the update_at field inside your update sentence to updated_at = $invoker-getUpdateAt() On 30 jul, 04:18, comb sa...@gmx.net wrote: Hi! I use the Timestampable behavior on a model. The model counts how often it was shown at a column views. Well as you might imagin, I want to update the views-column without changing the updated_at-value. How can I do this? example: public function incrementNbViews() { $invoker = $this-getInvoker(); // increment $invoker-setNbViews($invoker-getNbViews() + 1); // save $q = Doctrine::getTable(get_class($invoker))-createQuery(); $q-update() -set($q-getRootAlias().'.nb_views', '?', $invoker-getNbViews()) -where($q-getRootAlias().'.id = ?', $invoker-getId()) -execute(); } = updated_at should NOT change, but it does. -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
[symfony-users] Re: Timestampable
You can store the column in a separate table and link it to the master table 1:1 relationship. An even better solution is to store this in memcache (also use the memcache incrementation mechanism) and save this value in the database from time to time. gabriel On Jul 30, 11:18 am, comb sa...@gmx.net wrote: Hi! I use the Timestampable behavior on a model. The model counts how often it was shown at a column views. Well as you might imagin, I want to update the views-column without changing the updated_at-value. How can I do this? example: public function incrementNbViews() { $invoker = $this-getInvoker(); // increment $invoker-setNbViews($invoker-getNbViews() + 1); // save $q = Doctrine::getTable(get_class($invoker))-createQuery(); $q-update() -set($q-getRootAlias().'.nb_views', '?', $invoker-getNbViews()) -where($q-getRootAlias().'.id = ?', $invoker-getId()) -execute(); } = updated_at should NOT change, but it does. -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
[symfony-users] Re: Timestampable
Well I need the updated_at field if some other fields are updated. Only the views-field should not generate a change of the updated_at.. On Jul 30, 4:08 pm, Aldaron frala...@gmail.com wrote: If you don't need to auto update this field then you should not use timestampable.. Try to set the update_at field inside your update sentence to updated_at = $invoker-getUpdateAt() On 30 jul, 04:18, comb sa...@gmx.net wrote: Hi! I use the Timestampable behavior on a model. The model counts how often it was shown at a column views. Well as you might imagin, I want to update the views-column without changing the updated_at-value. How can I do this? example: public function incrementNbViews() { $invoker = $this-getInvoker(); // increment $invoker-setNbViews($invoker-getNbViews() + 1); // save $q = Doctrine::getTable(get_class($invoker))-createQuery(); $q-update() -set($q-getRootAlias().'.nb_views', '?', $invoker-getNbViews()) -where($q-getRootAlias().'.id = ?', $invoker-getId()) -execute(); } = updated_at should NOT change, but it does. -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
[symfony-users] Re: Timestampable
If you don't need to auto update this field then you should not use timestampable.. Try to set the update_at field inside your update sentence to updated_at = $invoker-getUpdateAt() On 30 jul, 04:18, comb sa...@gmx.net wrote: Hi! I use the Timestampable behavior on a model. The model counts how often it was shown at a column views. Well as you might imagin, I want to update the views-column without changing the updated_at-value. How can I do this? example: public function incrementNbViews() { $invoker = $this-getInvoker(); // increment $invoker-setNbViews($invoker-getNbViews() + 1); // save $q = Doctrine::getTable(get_class($invoker))-createQuery(); $q-update() -set($q-getRootAlias().'.nb_views', '?', $invoker-getNbViews()) -where($q-getRootAlias().'.id = ?', $invoker-getId()) -execute(); } = updated_at should NOT change, but it does. -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en