Automatic update of entity every day - symfony

I'm creating my portfolio with Symfony 3 and I want to show my skills with my experience.
I have a "Skill" entity with a "startAt" param (type=datetime) and a "exp" param (string).
The "exp" param = the difference between "startAt" and the current date.
I add some lifecycle callback so the "exp" param update every time I touch my "Skill" entity but here is my question:
How can I update my entity every day without touching it?
For exemple right now I have "exp = 6 months" but next month this param need to be "7 months".

Since "startAt" is likely mapped to a field name in the database called "start_at", this date is all the data you need to set and store. The method in the entity called getExp(), which maps to the variable "exp" would then take $this->startAt() value and calculate the difference between that start at time and the current time. You can use the PHP DateTime object to calculate the difference in units of days, months or years, depending on your preference.
Also, "exp" doesn't need to be a field you need to store or map to the database because it can easily be calculated on the fly based on the "startAt" date value anyway.

create a command that update your entity and make a cron tab with it

Related

Custom field days remaining to finish a task

How can I create a formula that allows me, in a custom field, to calculate the remaining days of the task, with respect to the last data cutoff (Status Date), as long as it is not 100% complete?
I have tried to create a simple formula to perform the initial test of the remaining days, using the status date field and the end field, [End]-[Status Date], but the result is wrong.
Just use the "Remaining Duration" column that already exists in MS Project, it shows exactly what you are asking for.

Validate expiration date automatically

I have created a table in Odoo, where I set the date and time of beginning and end of some activities.
What I want to do is that when the end date and time is less than the current date, update a field in the record.
You can use #api.onchange() or compute function to update value of field depending up on another field add #api.depends(field_name) , you write your condition inside this function so whenever value of a field changes this function will be triggered.
you can refer this link for oncahnge and compute function

D365 FO Simple Query for expiring contract

I need to create simple query which will show all contracts which will expire in next 3 months. I know how to do that with SQL, but how to do that in Visual Studio when I create query. I added data source Contract table. Added range. Column where is date about expiring is VALIDTO.
So, something to write up in value, or how to do that ?
Solved with two ranges on VALIDTO column. Used (MonthRange(0,3)) with (Day(0)) formulas.

Fullcalendar: change the names for startParam / endParam keys

I retrieve fullcalendar events from a database whose fields names for standard fullcalendar key names 'start' and 'end' are not 'start' and 'end'.
Is there a way to change those standard key names? It would be much simpler than manipulating the original data I receive from the database.
If you mean the "start" and "end" parameters which are sent to the server to tell the server the correct date range for which is should return events, then yes you can set https://fullcalendar.io/docs/startParam and https://fullcalendar.io/docs/endParam .
But if you mean the fields in the events which you output and send to fullCalendar, then no, you have to comply with the field names given at https://fullcalendar.io/docs/event-object so that the calendar knows what each field represents when reading the event data. Presumably you have some server-side code which reads the fields from the database and turns them into JSON? At that point it shouldn't be too difficult to just read your database date fields into object fields named "start" and "end" respectively. It's perhaps a bit of a chore, but you have to comply with the fullCalendar spec in this instance.
I solved this with alias in the query and works perfect. In my case:
$sentenciaSQL = $conn->prepare("SELECT name as title, start_date as start, end_date as end, color as color FROM project_list");
where conn is the DB connection.

Conditional field value in Access 2007

I created a database to keep track of customer service related follow-ups in a call centre environment.
My table has, among the others, a Date created field, a Due date field and a Status field (Open, Due or Overdue).
I would like the value indicated in the Status field to update automatically as time elapses.
Can this be achieved and how?
This is absolutely possible. Why not? I would suggest you do the following:
(1) add another status to the status field called 'closed'
(2) determine from a logorithmic perspective what 'Due' means (e.g. if the current date falls within 5 days of your due date
(3) Write a query which updates your status either 'due' or 'overdue' depending on what the current date is
UPDATE tblDue SET tblDue.Status = "Due"
WHERE (((tblDue.DueDate)=Now()));
UPDATE tblDue SET tblDue.Status = "Overdue"
WHERE (((tblDue.DueDate)>Now()));

Resources