小编Sam*_*Sam的帖子

Symfony2表单集合:显示当前对象的索引

我在表单中显示集合时遇到问题.

在显示我的实体集时,我有这样的事情:

0
Name: myInputName
Address: myInputAddress

1
Name: myInputName
Address: myInputAddress
Run Code Online (Sandbox Code Playgroud)

我的问题是为什么Symfony2显示索引 ...

这对于所有已保存的实体都进入了我的收藏......

这里是我使用的代码:

$builder            
        ->add('person', 'collection', array(   
            'label' => ' ',             
            'type' => new PersonType(),
            'prototype' => true,
            'allow_add' => true,
            'allow_delete' => true,
            'by_reference' => false,
        ))
    ;
Run Code Online (Sandbox Code Playgroud)

在我的twig文件中:

<div>
    {{ form_widget(edit_form) }}    
</div>
Run Code Online (Sandbox Code Playgroud)

请帮忙

山姆

forms symfony

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

调用php app/console doctrine:schema:update时,Symfony2允许内存耗尽

我有一个大问题......

我想更新我的数据库的架构,我有一个问题.

当我运行这个脚本时:

php app/console doctrine:schema:update --dump-sql
Run Code Online (Sandbox Code Playgroud)

我有这个错误:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 32 bytes) in /Applications/MAMP/htdocs/myApp/vendor/doctrine/lib/Doctrine/ORM/Tools/SchemaTool.php on line 509
Run Code Online (Sandbox Code Playgroud)

我试图在php.ini中增加memory_limit,但没有任何效果.

我跑了php app/console cache:clear但是什么也没做.还是同样的问题 ......

请帮忙...

我无能为力......

symfony

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

jqplot - 日期轴渲染器:国际化

我使用jqplot,我的日期是我的x轴.

我使用DateAxisRenderer插件,但我想将日期转换为我当前的语言环境.

例如,对于英语

Jan 2012 
Feb 2012...
Run Code Online (Sandbox Code Playgroud)

对于法国人

Jan 2012
Fév 2012...
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

jquery internationalization jqplot

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

Symfony2表单集合:如何从集合中删除实体?

我尝试从集合中删除实体,但它不起作用.

我想我某处有错,但我不知道在哪里.

这里是我的代码updateAction:

    $em = $this->getDoctrine()->getEntityManager();

    $entity = new Person();

    if (!$entity) {
        throw $this->createNotFoundException('Unable to find Person entity.');
    }

    $editForm   = $this->createForm(new PersonType(), $entity);
    $deleteForm = $this->createDeleteForm($id);

    $request = $this->getRequest();

    $editForm->bindRequest($request);

    if ($editForm->isValid()) {
        $entity = $editForm->getData();

        $em->persist($entity);
        foreach($entity->getAddresses() as $address)
        {               
            $em->persist($address);
        }
        $em->flush();                                 

        return $this->redirect($this->generateUrl('person_show', array('id' => $id)));
    }

    return $this->render('AppPersonBundle:Person:edit.html.twig', array(
        'entity'      => $entity,
        'edit_form'   => $editForm->createView(),
        'delete_form' => $deleteForm->createView(),

    );
Run Code Online (Sandbox Code Playgroud)

请注意,要删除我的实体,我从html中删除div.

我的意思是我删除<div id="myapp_personbundle_persontype_address_4">了例如.

这是正确的方法吗?

php forms symfony-forms symfony

4
推荐指数
2
解决办法
2万
查看次数

Symfony2 + swift mailer +命令:显示在控制台中的电子邮件正文

我已经在我的Symfony应用程序中创建了一个新命令.

在此命令中,我调用一个服务,该服务从FOS包发送邮件 作为邮件程序.

我的问题是电子邮件正文显示在控制台中以发送电子邮件.

我想说的是,该msg mailer方法工作正常进行的命令.

这是我的命令:

class ReminderCommand extends Command
{
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->container = $this->getApplication()->getKernel()->getContainer();            

        # the mailer service works fine out the command
        $mailer = $this->container->get('mailer');
        $mailer->sendMsg(...);          


        $text = ' => mail sent';

        $output->writeln($text);
    }
}
Run Code Online (Sandbox Code Playgroud)

请帮忙

谢谢

山姆

swiftmailer symfony

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

Symfony2:错误部署

将symfony项目手动部署到我的服务器时出错.我甚至无法执行任何控制台命令缓存:清除.我用过:

php app/console cache:clear --no-warmup
PHP Notice:  Undefined index: argv in /app/vendor/symfony/src/Symfony/Component/Console/Input/ArgvInput.php on line 57
PHP Warning:  array_shift() expects parameter 1 to be array, null given in /app/vendor/symfony/src/Symfony/Component/Console/Input/ArgvInput.php on line 61
PHP Warning:  array_shift() expects parameter 1 to be array, null given in /app/vendor/symfony/src/Symfony/Component/Console/Input/ArgvInput.php on line 294
PHP Warning:  Invalid argument supplied for foreach() in /app/vendor/symfony/src/Symfony/Component/Console/Input/ArgvInput.php on line 269
Status: 500 Internal Server Error
X-Powered-By: PHP/5.3.8-pl0-gentoo
cache-control: no-cache
date: Fri, 10 Feb 2012 15:31:08 GMT
content-type: text/html; charset=UTF-8

<br /> …
Run Code Online (Sandbox Code Playgroud)

deployment symfony

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