1
我正在使用Propel 1.6.x,並希望能夠從Propel Connection對象中檢索連接名稱。這是爲了便於對象的存儲在一個單獨的方法,即:我可以從Propel連接獲取連接名稱嗎?
// If this is called twice with different connections,
// the second one will be wrong
protected function getHashProvider(PropelPDO $con)
{
static $hashProvider;
// Would like to use something like $con->getName() to
// store each instantiation in a static array...
if (!$hashProvider)
{
$hashProvider = Meshing_Utils::getPaths()->getHashProvider($con);
}
return $hashProvider;
}
由於連接目的是通過提供一個連接名(或接受默認名稱)我還以爲這個實例將被存儲在對象中。但通過代碼的粗略觀察似乎表明它只用於查找連接細節,而不是自己存儲。
有沒有我錯過了,或者我應該提交它作爲Propel2的建議? :)