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 7] undefined class constant slug

Discussion around this tutorial for symfony 1.2-1.4

[DAY 7] undefined class constant slug

by baptiste » Tue Mar 22, 2011 5:38 pm

Hello everybody, I'm on the day 7 and I success to show "and 27 more..." but after I have change schema.yml by adding the slug column when I run :
Code: Select all
$ symfony propel:build --all --and-load --no-confirmation

In the "insert-sql" part I've an error ....
Code: Select all
PHP Fatal error:  Undefined class constant 'slug' in C:\development\sfprojects\jobeet\lib\model\om\BaseJobeetCategory.php on line 165

PHP Stack trace:
PHP   1. {main}() C:\development\sfprojects\jobeet\symfony:0
PHP   2. include() C:\development\sfprojects\jobeet\symfony:15
PHP   3. sfSymfonyCommandApplication->run() C:\development\sfprojects\jobeet\lib\vendor\symfony\lib\command\cli.php:20
PHP   4. sfTask->runFromCLI() C:\development\sfprojects\jobeet\lib\vendor\symfony\lib\command\sfSymfonyCommandApplication.class.php:76
PHP   5. sfBaseTask->doRun() C:\development\sfprojects\jobeet\lib\vendor\symfony\lib\task\sfTask.class.php:97
PHP   6. sfPropelBuildTask->execute() C:\development\sfprojects\jobeet\lib\vendor\symfony\lib\task\sfBaseTask.class.php:68
PHP   7. sfTask->run() C:\development\sfprojects\jobeet\lib\vendor\symfony\lib\plugins\sfPropelPlugin\lib\task\sfPropelBuildTask.class.php:194
PHP   8. sfBaseTask->doRun() C:\development\sfprojects\jobeet\lib\vendor\symfony\lib\task\sfTask.class.php:173
PHP   9. sfPropelDataLoadTask->execute() C:\development\sfprojects\jobeet\lib\vendor\symfony\lib\task\sfBaseTask.class.php:68
PHP  10. sfPropelData->loadData() C:\development\sfprojects\jobeet\lib\vendor\symfony\lib\plugins\sfPropelPlugin\lib\tasksfPropelDataLoadTask.class.php:103
PHP  11. sfData->doLoadData() C:\development\sfprojects\jobeet\lib\vendor\symfony\lib\plugins\sfPropelPlugin\lib\addon\sfPropelData.class.php:52
PHP  12. sfData->doLoadDataFromFile() C:\development\sfprojects\jobeet\lib\vendor\symfony\lib\addon\sfData.class.php:81
PHP  13. sfPropelData->loadDataFromArray() C:\development\sfprojects\jobeet\lib\vendor\symfony\lib\addon\sfData.class.php:58
PHP  14. BaseJobeetCategory->setByPosition() C:\development\sfprojects\jobeet\lib\vendor\symfony\lib\plugins\sfPropelPlugin\lib\addonsfPropelData.class.php:151

PHP  15. JobeetCategory->setName() C:\development\sfprojects\jobeet\lib\model\om\BaseJobeetCategory.php:651
PHP  16. BaseJobeetCategory->setSlug() C:\development\sfprojects\jobeet\lib\model\JobeetCategory.php:40

So i look for where is the error and I haven't found, just here
Code: Select all
public function setName($name)
  $this->setSlug(Jobeet::slugify($name)); // If i comment this line the error disapear

Yet I've copy the code of tutorial, and the snapshot doesn't work also ... an idea ?

Thanx' a lot :)
Junior Member
Posts: 3
Joined: Mon Feb 21, 2011 4:59 pm

Re: [DAY 7] undefined class constant slug

by halfer » Wed Jun 29, 2011 11:07 am

Ah, old question. Ensure that BaseJobeetCategory.php contains a column called 'slug' - it should be at the start of this file.

Also, when asking a question like this I would normally should a few lines of the file in question, probably lines 150-180 in this case. In code tags :)
Faithful Member
Posts: 10148
Joined: Mon Jan 30, 2006 1:16 pm
Location: West Midlands, UK