symfony PHPフレームワークpart2 (531レス)
上下前次1-新
抽出解除 レス栞
273(1): nobodyさん [sage] 2010/11/17(水) 05:46:56 ID:??? AAS
 C:\MyProject\link>php symfony link:access user01 111.111.111.111 
  
 #accessTask.class.php 
 <?php 
  
 class accessTask extends sfBaseTask 
 { 
  public function configure() 
  { 
   $this->namespace = 'link'; 
   $this->name   = 'access'; 
   $this->addArgument('username', sfCommandArgument::OPTIONAL); 
   $this->addArgument('ip', sfCommandArgument::OPTIONAL); 
  } 
  
  public function execute($arguments = array(), $options = array()) 
  { 
  
   $access = new Accesslog(); 
   $access->setUsername($arguments['username']); 
   $access->setIp($arguments['ip']); 
   $access->save(); 
   $this->log('access from '. $arguments['ip']); 
  } 
 }
274: nobodyさん [sage] 2010/11/17(水) 10:31:09 ID:??? AAS
 >>273 
 ・extends sfDoctrineBaseTaskにする 
 ・executeの冒頭に 
     $configuration = $this->createConfiguration('users', 'cli'); 
     new sfDatabaseManager($this->configuration); 
 と書く。 
  
 理屈は知らんがw 
 doctrineならこれで動くんじゃね 
上下前次1-新書関写板覧索設栞歴
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 0.895s*