小编Zar*_*ele的帖子

在迁移文件中使用EntityManager

我有这个代码,但不起作用:

<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration,
    Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your need!
 */
class Version20131021150555 extends AbstractMigration
{

    public function up(Schema $schema)
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");

        $this->addSql("ALTER TABLE person ADD tellphone LONGTEXT DEFAULT NULL");

        $em = $em = $this->getDoctrine()->getEntityManager();
        $persons = $em->getRepository('AutogestionBundle:Person')->fetchAll();

        foreach($persons as $person){
            $person->setTellPhone($person->getCellPhone());
            $em->persist($person);                                                                            
        }
        $em->flush(); 
    }

    public function down(Schema $schema)
    {
        // …
Run Code Online (Sandbox Code Playgroud)

migration symfony doctrine-orm

21
推荐指数
3
解决办法
1万
查看次数

Magento:获取订单ID,收听事件checkout_onepage_controller_success_action

当我查看事件checkout_onepage_controller_success_action并且工作时,但我无法获得新创建的订单的ID.

任何人都有任何想法?

使用magento-1.4.1.0

谢谢

events module magento-1.4

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

标签 统计

doctrine-orm ×1

events ×1

magento-1.4 ×1

migration ×1

module ×1

symfony ×1