public function run()
 {
     DB::table('players')->delete();
     Player::create(array('user_id' => 3, 'nom' => 'Bourdon', 'prenom' => 'Jean-Paul', 'nation_id' => 2, 'hcp' => 2.5, 'langue_id' => 1, 'club_id' => 2, 'statusplayer_id' => 1, 'sexe_id' => 1, 'naissance' => '1961-03-29', 'licence' => '344787'));
     DB::table('managers')->delete();
     Manager::create(array('user_id' => 2, 'nom' => 'Bourdon', 'prenom' => 'Jean-Paul', 'statussocial_id' => 2, 'numtva' => 'BE48-2525-5262', 'adr1' => 'Chss de Nivelles, 41-1', 'cpost' => '7181', 'ville' => 'Arquennes', 'nation_id' => 2, 'langue_id' => 1));
 }
Esempio n. 2
0
 /**
  *  Create a new extensible object
  *
  *  @param \Mecum\Component\ManagerInterface $em
  *
  *  @return self 
  */
 public static function create(ManagerInterface $em = null)
 {
     return new static($em ?: Manager::create());
 }
Esempio n. 3
0
 /**
  * Delete a value on the session
  *
  * @param string				$key
  * @param string				$manager
  * @return Session\Manager
  */
 public static function delete($key, $manager = null)
 {
     return Manager::create($manager)->delete($key);
 }
Esempio n. 4
-1
 /**
  *@usage 项目创建涉及 project 及manager 
  */
 public static function addProject($project_info, $manager_info)
 {
     try {
         $manager = new TxManager();
         $transaction = $manager->get();
         #先分别存储project 和 manager
         $project = new Project();
         $project->setTransaction($transaction);
         foreach ($project_info as $key => $value) {
             $project->{$key} = $value;
         }
         $manager = new Manager();
         $manager->setTransaction($transaction);
         foreach ($manager_info as $key => $value) {
             $manager->{$key} = $value;
         }
         $manager->project_id = $project_info['id'];
         #先插入项目
         if ($project->create() == false) {
             $transaction->rollback("数据插入失败-" . print_r($project, true));
         }
         #再插入项目经理
         if ($manager->create() == false) {
             $transaction->rollback("数据删除失败-" . print_r($manager, true));
         }
         #再更新项目
         $project->manager_id = $manager->id;
         if ($project->save() == false) {
             $transaction->rollback("数据删除失败-" . print_r($project, true));
         }
         $transaction->commit();
         return true;
     } catch (TxFailed $e) {
         throw new Exception($e->getMessage());
     }
 }