我使用Symfony 3.4.47 w/MySQL 8,直到今天,獲得一個欄位的值也不是什么大問題。
我創建了一個遷移檔案,為一個現有的物體添加一個新的欄位:
我創建了一個遷移檔案。
$this->addSql('ALTER TABLE plano ADD cliente_apelido VARCHAR(40) NOT NULL'/span>)。
我已經在'Plano.php'模型中添加了'cliente_apelido'欄位,getter和setter:
/**.
* @var string
*
* @ORMColumn(name="cliente_apelido", type="string", length=40, nullable=false)
*/
private $clienteapelido;
/**。
* @param string $clienteapelido
*/
public function setClienteapelido(string $clienteapelido) 。void: void.
{
$this-> clienteapelido = $clienteapelido;
}
/**。
* 獲取clienteapelido。
*
* @return string
*/
public function getClienteapelido()
{
return $this-> clienteapelido;
}
結果是,當我試圖使用getClienteapelido()getter時,它回傳了一個空字串,我不知道哪里出了問題:
我不知道該怎么辦。
$plano = $this->doctrin->getRepository('PlanoBundle: Plano')->find(99); //99只是'plano'物體有效行的一個例子。
if ($plano) {
$this->logger->critical("Found 'plano' id="/span> . $plano->getCodplano() )。
// This prints to the log file:
// [2021-09-13 09:36:31] app.CRITICAL: 發現'plano' id=99
$this->logger->critical("apelido=["/span> . $plano->getClienteapelido() . "]")。)
// This prints to the log file:
// [2021-09-13 09:36:31] app.CRITICAL: apelido=[]/span>
}
更糟糕的是:上面的代碼在DEV環境中作業但在生產環境中不作業。 我知道這聽起來顯然是一個環境問題,但我不知道該去哪里找。
有什么想法嗎?
***編輯:**問題是我在Symfony的cache檔案夾上有一些權限錯誤的檔案/檔案夾,這使得我的部署無法清理它,這種奇怪的行為就是后果。
uj5u.com熱心網友回復:
問題是我有一些檔案/檔案夾在Symfony的cache檔案夾上有錯誤的權限,這使得我的部署無法清理它,這種怪異的行為就是后果。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/310758.html
標籤:
