小编Tai*_*uch的帖子

教义日期时间无法转换为字符串

我正在使用 symfony 2.3 和学说 2.2。我创建了一个控制台命令,以便在数据库中插入一些数据。当我尝试使用当前日期更新时间列时,收到此错误

    Catchable fatal error: Object of class DateTime could not be converted to string
 in D:\xampp\htdocs\biginfo\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Expr\Comp
arison.php on line 98  
Run Code Online (Sandbox Code Playgroud)

命令.php

protected function configure() {
        $this
                ->setName('biginfo:invoice')
                ->setDescription('Générer les factures de chaque commercial chaque début du mois')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output) {

        $users = $this->findByRole('ROLE_COMMERCIAL');
        // update invoice
        $this->updateInvoice($users);
        $this->updateStatus();
    }

    public function updateStatus() {
        $em = $this->getContainer()->get('doctrine.orm.entity_manager');
        $queryBuilder = $em->createQueryBuilder();
        $queryBuilder
                ->update('Biginfo\UserBundle\Entity\User', 'u')
                ->set('u.nbrBusiness', 0)
                ->set('u.time', new \DateTime(date('Y-m-d')));
        return $queryBuilder->getQuery();
    } …
Run Code Online (Sandbox Code Playgroud)

php symfony doctrine-orm

1
推荐指数
1
解决办法
6173
查看次数

elasticsearch 不返回所有命中

我使用的是 Symfony 2.3 和 ElasticSearchBundle 3.0。我为搜索实现了两个字段。搜索工作正常,但未显示所有结果。例如:当我搜索 a 关键字时,点击次数为 33,但它只返回 10 个结果。
配置文件

fos_elastica:
    clients:
        default: { host: localhost, port: 9200 }
    serializer:
        callback_class: FOS\ElasticaBundle\Serializer\Callback
        serializer: serializer
    indexes:
        hortis:
            finder: ~
            client: default
            settings:
                index:
                    analysis:
                        analyzer:
                            custom_search_analyzer:
                                type: custom
                                tokenizer: standard
                                filter   : [standard, lowercase, asciifolding]
                            custom_index_analyzer:
                                type: custom
                                tokenizer: standard
                                filter   : [standard, lowercase, asciifolding, custom_filter]
                        filter:
                            custom_filter:
                                type: edgeNGram
                                side: front
                                min_gram: 3
                                max_gram: 100
            types:
                business:
                    mappings:
                        name:  { search_analyzer: custom_search_analyzer, index_analyzer: custom_index_analyzer, type:string }
                        enabled: ~ …
Run Code Online (Sandbox Code Playgroud)

symfony elasticsearch

0
推荐指数
1
解决办法
2460
查看次数

标签 统计

symfony ×2

doctrine-orm ×1

elasticsearch ×1

php ×1