本文整理汇总了PHP中Manager::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::create方法的具体用法?PHP Manager::create怎么用?PHP Manager::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manager
的用法示例。
在下文中一共展示了Manager::create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
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));
}
示例2: create
/**
* 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());
}
示例3: delete
/**
* 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);
}
示例4: addProject
/**
*@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());
}
}