feuser编辑时出错:不是整数

时间:2017-05-10 07:44:59

标签: typo3

我使用自定义字段扩展feuser。一切顺利。如果我输入整数值,那么保存得很好。但是,如果我输入字符串值,我会收到错误 - 1332933658:“”不是整数。您可以在以下屏幕截图中看到这一点。

enter image description here

enter image description here

ext_tables.php

#
# Table structure for table 'fe_users'
#
CREATE TABLE fe_users (
        aboutmyself varchar(255) DEFAULT '' NOT NULL,
    aboutmypartner varchar(255) DEFAULT '' NOT NULL,
    tx_extbase_type varchar(255) DEFAULT '0' NOT NULL,
);

型号:

<?php
namespace Fhk\Feusersplus\Domain\Model;

/***************************************************************
 *
 *  Copyright notice
 *
 *  (c) 2017
 *
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
 *  free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  The GNU General Public License can be found at
 *  http://www.gnu.org/copyleft/gpl.html.
 *
 *  This script is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/

/**
 * User
 */
class User extends \In2code\Femanager\Domain\Model\User
{

    /**
     * aboutmyself
     *
     * @var int
     */
    protected $aboutmyself = '';

    /**
     * aboutmypartner
     *
     * @var int
     */
    protected $aboutmypartner = '';


    /**
     * Returns the aboutmyself
     *
     * @return int $aboutmyself
     */
    public function getAboutmyself()
    {
        return (string)$this->aboutmyself;
    }

    /**
     * Returns the aboutmypartner
     *
     * @return int $aboutmypartner
     */
    public function getAboutmypartner()
    {
        return (string)$this->aboutmypartner;
    }



    /**
     * Sets the aboutmyself
     *
     * @return void
     */
    public function setAboutmyself($aboutmyself)
    {
        $this->aboutmyself = (string)$aboutmyself;
    }

    /**
     * Sets the aboutmypartner
     *
     * @return void
     */
    public function setAboutmypartner($aboutmypartner)
    {
        $this->aboutmypartner = (string)$aboutmypartner;
    }







    /**
     * __construct
     */
    public function __construct()
    {
        //Do not remove the next line: It would break the functionality
        $this->initStorageObjects();
    }

    /**
     * Initializes all ObjectStorage properties
     * Do not modify this method!
     * It will be rewritten on each save in the extension builder
     * You may modify the constructor of this class instead
     *
     * @return void
     */
    protected function initStorageObjects()
    {

    }


}

1 个答案:

答案 0 :(得分:1)

关于myself和aboutmypartner的字段的类型提示定义为

@var int

但您存储了VARCHAR。尝试将提示更改为

@var string

并清除所有缓存(同样,清空typo3temp文件夹也不会受到伤害)。