This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Day 6 - can't load new job

Discussion around this tutorial for symfony 1.2-1.4

Day 6 - can't load new job

by Pilar López » Fri Jun 08, 2012 5:03 pm

Got stuck on Day 6 - can't load new job
symfony doctrine:data-load
Error Not Null violation on column expires_at

All jobs have created_at values and all except the last one have also expires_at values.
If I add the expires_at value, the data is loaded, so the jobs.yml file should be OK.

This is my save function:
//lib/model/doctrine/JobeetJob.class.php:
class JobeetJob extends BaseJobeetJob
{
//.. get...Slug functions
public function save(Doctrine_Connection $conn = null)
{
if ($this->isNew() && !$this->getExpiresAt())
{
$now = $this->getCreatedAt() ? $this->getDateTimeObject('created_at')->format('U') : time();
$this->setExpiresAt(date('Y-m-d H:i:s', $now + 86400 * 30));
}
return parent::save($conn);
}
}

I also tried $this->setExpiresAt('2012-06-06 00:00:00') but no success.
Of course, I double checked the code, cleared the cache, checked the spaces, read all messages on the forum... still no clue.
I wonder if the save function is called at all. Should this be visible in the log file?
Pilar López
Junior Member
 
Posts: 2
Joined: Wed Jun 06, 2012 6:39 pm

Re: Day 6 - can't load new job

by Pilar López » Thu Jun 14, 2012 8:41 pm

I still can't load new jobs with missing expires_at values.
In the meantime I found the SQL sentence in the database log: expires_at is not on the fields list of the SQL sentence (and consequently no VALUE for it is passed) which causes the NOT NULL violation.
I wonder if doctrine:data-load actually calls the save function? And, the updated_at values which are not given are indeed generated correctly, but where??
What am I missing?
Pilar López
Junior Member
 
Posts: 2
Joined: Wed Jun 06, 2012 6:39 pm