本文整理匯總了PHP中Doctrine_Connection::prepare方法的典型用法代碼示例。如果您正苦於以下問題:PHP Doctrine_Connection::prepare方法的具體用法?PHP Doctrine_Connection::prepare怎麽用?PHP Doctrine_Connection::prepare使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine_Connection
的用法示例。
在下文中一共展示了Doctrine_Connection::prepare方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: rechargerUserProjet
public static function rechargerUserProjet($usersprojets, Doctrine_Connection $conn = null)
{
$conn->execute("TRUNCATE TABLE ei_project_user");
//On vide la table pour purger les utilisateurs
$userprojet = $usersprojets->getElementsByTagName("user_projet");
if ($userprojet->length > 0) {
//s'il ya au moins une balise trouvé
$stmt = $conn->prepare("INSERT INTO ei_project_user (project_id, user_id, project_ref,user_ref,role) " . "VALUES (:project_id, :user_id, :project_ref,:user_ref,:role) " . "ON DUPLICATE KEY UPDATE project_id=project_id,user_id=user_id,project_ref=project_ref,user_ref=user_ref,role=:role");
foreach ($userprojet as $u) {
$project_id = $u->getAttribute("project_id");
$user_id = $u->getAttribute("user_id");
$project_ref = $u->getAttribute("project_ref");
$user_ref = $u->getAttribute("user_ref");
$role = $u->getElementsByTagName("role")->item(0)->nodeValue;
//recherche du projet en base
if ($project_id != null && $project_ref != null) {
$q = Doctrine_Core::getTable('EiProjet')->findOneByProjectIdAndRefId($project_id, $project_ref);
if ($q && $q != null) {
//si le projet existe
$stmt->bindValue("project_id", $project_id);
$stmt->bindValue("user_id", $user_id);
$stmt->bindValue("project_ref", $project_ref);
$stmt->bindValue("user_ref", $user_ref);
$stmt->bindValue("role", $role);
$stmt->execute(array());
}
}
}
}
}