helper, not model. Except case when you need this timing data in
controller.
On May 7, 4:40 am, bmcelhany <bmcelh...@gmail.com> wrote:
> Hello,
>
> I have a model (Project) that has a projected_end_date field. What I'd
> like to do in the view is calculate the number of days from the
> current date until the projected end date and display how much time is
> left (or how many days overdue). This data really only needs to be in
> a single view, so I have no problems just embedding the logic directly
> into the view...I'm doing that now and it works fine.
>
> Even though it's working, it just feels wrong. It seems like this
> logic really should be in the model itself since it's data (calculated
> data and not stored in a table, but still data).
>
> Is this possible? I tried creating a getTiming() function in my
> Project model, but I couldn't figure out any way to call it from my
> view:
>
> echo $project['Project']->getTiming()
> echo $project->getTiming()
> echo $this->Project->getTiming()
> etc.
>
> I may end up just abstracting the logic out into a helper and calling
> that in the view. Any thoughts? Thanks!
>
> -Brian
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment