cakephp3get方法不返回字段

mm9b1k5b  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(190)

cakephp 3.5版。
php 7.2.8版
docker环境
mysql版本15.1发行版10.1.26-mariadb,用于使用readline 5.2的debian linux gnu(x86_64)

CREATE TABLE `feedback_calls` (
  `ID` bigint(20) NOT NULL AUTO_INCREMENT,
  `USER_ID` bigint(20) DEFAULT NULL,
  `TENDER_ID` bigint(20) DEFAULT NULL,
  `MANAGER_ID` bigint(20) DEFAULT NULL,
  `TITLE` varchar(255) DEFAULT NULL,
  `STATUS` varchar(255) DEFAULT NULL,
  `EVENT_START` datetime DEFAULT NULL,
  `EVENT_END` datetime DEFAULT NULL,
  `CREATED_ON` datetime DEFAULT NULL,
  `CREATED_BY` bigint(20) DEFAULT NULL,
  `LOCKED_TIME` datetime DEFAULT NULL,
  `UPDATED_ON` datetime DEFAULT NULL,
  `UPDATED_BY` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ID_UNIQUE` (`ID`),
  KEY `FK_Tender_idx` (`TENDER_ID`),
  KEY `FK_FeedbackCalls_User_idx` (`USER_ID`),
  CONSTRAINT `FK_Tender` FOREIGN KEY (`TENDER_ID`) REFERENCES `dls_tender` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_FeedbackCalls_User` FOREIGN KEY (`USER_ID`) REFERENCES `dir_user` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8

mysql表包含:

型号:

<?php
namespace App\Model\Table;

use Cake\Datasource\EntityInterface;
use Cake\ORM\Table;
use Cake\Validation\Validator;
use Cake\Network\Exception\NotFoundException;
use Cake\Log\Log;
use Cake\Database\Type;
use Cake\I18n\Time;

final class FeedbackCallsTable extends Table
{

use VirtualFieldsTrait;

/**
 * @param array $config The configuration for the Table.
 */
public function initialize(array $config)
{
    parent::initialize($config);
    $this->setTable('feedback_calls');
    $this->setDisplayField('ID');
    $this->setPrimaryKey('ID');
}

public function index($id = null)
{
    $eventData = $this->get($id);
    log::debug($eventData);
}
}

当我使用cakephp3get方法时,我得到的manager\ id值为null。

log::debug("ID is ::".$id);
    $eventData = $this->get($id);
    log::debug("EventData is :: ");
    log::debug($eventData);

输出:

附加信息:更新操作时也不保存字段。我已经清除了缓存表,也试图找到方法,但得到了相同的结果。欢迎提出任何解决方案/建议。谢谢。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题