cakephp 3 get方法不返回字段

时间:2018-09-04 10:25:09

标签: php mysql cakephp get cakephp-3.0

  • CakePHP 3.5。
  • PHP 7.2.8
  • Docker环境
  • mysql版本15.1发行版 10.1.26-MariaDB,适用于使用readline 5.2的debian-linux-gnu(x86_64)
  

#include <iostream>
using namespace std;

int turn_yeh(int &x, int &y)
{
    static int t = 0;

    cout << "t : " << t << " x: "<< x<< " y : " << y<<endl;

    if (t != 0 && t% 3 == 0) return 1;
    if(x!= 0 && t!= 2){x--; t++; turn_yeh(x,y);}
    else if(y >=10 && t!=2){y -= 10*t; turn_yeh(x,y);}
    if( y >= 2 && t == 2){y -= 2; t++; turn_yeh(x,y);}
    else return 0;
}


int main()
{
    int x, y;
    cin >> x >> y;

    int i = 1;
    while (1)
    {
        i = turn_yeh(x ,y);
        cout << "i : " << i << endl;
        if (i == 0)
        {
            cout << "Hanako";
            return 0;
        }

    }
}

MySQl表包含:

enter image description here

型号:

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

当我使用cakephp 3 get method时,我得到的MANAGER_ID值为空。

<?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);
}
}

输出:: enter image description here

其他信息:更新操作时也不会保存该字段。我已经清除了缓存表,还尝试查找方法,但是得到了相同的结果。任何解决方案/建议都欢迎。谢谢。

0 个答案:

没有答案