我在src/CollaboratorsBundle/Command中创建了一个新类,将其命名为GenerateFormRemindersCommand.php并将以下代码放入其中:
<?php
namespace Myproject\CollaboratorsBundle\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
class GenerateFormRemindersCommand extends ContainerAwareCommand{
protected function configure() {
$this->setName("generate:formReminders")
->setDescription('Send reminders by email to all collaborators with unanswered forms');
}
protected function execute(InputInterface $input, OutputInterface $output) {
//some code
}
}
Run Code Online (Sandbox Code Playgroud)
执行时,我收到以下消息:
$ php app/console generate:formReminders
[InvalidArgumentException]
Command "generate:formReminders" is not defined.
Run Code Online (Sandbox Code Playgroud)
我已经在我的AppKernel.php文件中检查了我的捆绑包已在其中注册了.
我尝试过添加parent:configure(); 到configure方法但没有任何结果.
我已经创建了一些其他正常工作的自定义命令.在这种情况下,我不明白我做错了什么.你呢 ?
提前致谢
我在表中有这些文本输入:
<td><input type='text' name='arrondi_devis_ht' class='calcul_total' size='8'></td>
<td><input type='text' name='arrondi_devis_ttc' class='calcul_total' size='8'></td>
<td><input type="text" name='marge_pourcent' class='calcul_total' size='5' value='20,0'></td>
Run Code Online (Sandbox Code Playgroud)
通过执行以下操作,我成功地获得了它们的价值:
var prix_unitaire_ht=parseFloat($(this).parents("tr").find('input[name="arrondi_devis_ht"]').val().replace(',','.'));
var prix_unitaire_ttc=parseFloat($(this).parents("tr").find('input[name="arrondi_devis_ttc"]').val().replace(',','.'));
var marge_pourcent=parseFloat($(this).parents("tr").find('input[name="marge_pourcent"]').val().replace(',','.'));
Run Code Online (Sandbox Code Playgroud)
所以我想我可以使用类似的机制来设置它们的值,并尝试这样做:
$(this).parents("tr").find('input[name="arrondi_devis_ht"]').value=new_prix_ht;
$(this).parents("tr").find('input[name="arrondi_devis_ttc"]').value=new_prix_ttc;
$(this).parents("tr").find('input[name="marge_pourcent"]').value=new_marge;
Run Code Online (Sandbox Code Playgroud)
但是,它不起作用,其价值保持不变。我尝试用.val代替值,也给他们分配一个id并find("#id").value代替上面的方法做而没有任何结果。
谁能告诉我我在做什么错?