symfony1.2でDoctrine1.1使ってJobeetチュートリアル13日目

後半戦突入!

User Attributes

// apps/frontend/modules/job/actions/actions.class.php

<?php
class jobActions extends sfActions
{
  public function executeShow(sfWebRequest $request)
  {
    $this->job = $this->getRoute()->getObject();
 
    // fetch jobs already stored in the job history
    $jobs = $this->getUser()->getAttribute('job_history', array());
 
    // add the current job at the beginning of the array
    // array_unshift($jobs, $job->getId()); <- this抜けてる
    array_unshift($jobs, $this->job->getId());

 
    // store the new job history back into the session
    $this->getUser()->setAttribute('job_history', $jobs);
  }
 
  // ...
}

Backend Security

taskにguardコマンド出てこない。orz

subversionで最新版チェックアウトしてくれば、動いた。

ただし、sfGuardCreateUserTask.class.phpファイルにsfDoctrineBaseTask.class.phpをインクルードする必要あり。

// plugins/sfDoctrineGuardPlugin/lib/task/sfGuardCreateUserTask.class.php

<?php

require_once 'sfDoctrinePluginまでのパス/lib/task/sfDoctrineBaseTask.class.php'

/**
 * Create a new user.
 *
 * @package    symfony
 * @subpackage task
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
 * @version    SVN: $Id: sfGuardCreateUserTask.class.php 8109 2008-03-27 10:40:33Z fabien $
 */
class sfGuardCreateUserTask extends sfDoctrineBaseTask
{
// ...

結論


symfony 1.2.1 stableでDoctrine使うのは、無理。


testの回もだましだまし使っていたけれど、やっぱ苦しい。
stableでdoctrine使いたい人は、1.2.2まで待った方がよさげです。


以降は、1.2.2 beta前提で行きます。

まだいける!

// config/ProjectConfiguration.class.php

<?php

require_once '/usr/share/pear/symfony/autoload/sfCoreAutoload.class.php';

sfCoreAutoload::register();

class ProjectConfiguration extends sfProjectConfiguration
{
  public function setup()
  {
    // for compatibility / remove and enable only the plugins you want
    $this->enableAllPluginsExcept(array('sfPropelPlugin', 'sfCompat10Plugin'));
  }
}

ProjectConfiguration.class.phpで全てのpluginの使用を許可したら、guardコマンド出ました。