我正在尝试在功能测试期间禁用"软可删除"过滤器,我按以下方式执行:
第一个选项:尝试tearDown()在我的测试中禁用:
protected function tearDown() {
parent::tearDown();
$entityUser = $this->em->getRepository("UserSecurityBundle:User")->find($this->user->getUser()->getId());
$filter = $this->em->getFilters()->disable('softdeleteable');
$this->em->remove($entityUser);
$this->em->flush();
$this->em->close();
}
Run Code Online (Sandbox Code Playgroud)
没工作.
第二个选项:创建一个doctrine_test.yml并在config_test.yml中导入:
imports:
- { resource: config.yml }
- { resource: doctrine_test.yml }
- { resource: security_test.yml }
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我删除doctrine.yml并包含在config_prod.yml.
没工作.
这是我的doctrine_test.yml部分的样子:
filters:
softdeleteable:
class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
enabled: false
Run Code Online (Sandbox Code Playgroud)
第三个选项:禁用过滤器setUp():
public function setUp() {
static::$kernel = static::createKernel();
static::$kernel->boot();
$this->em = static::$kernel->getContainer()->get('doctrine')->getManager();
$fixture = new LoadFeeData();
$fixture->load($this->em);
$this->em->getFilters()->disable('softdeleteable');
$this->user = $this->createUser();
parent::setUp();
}
Run Code Online (Sandbox Code Playgroud)
没工作.
有什么建议?解?
我使用 SmartGit 克隆了一个 repo,但现在遵循良好的做法,我将在development分支上开始开发,然后将这个与 master 合并,但我不知道如何从 SmartGit 在它们之间进行更改。见下图:

我在那里右键单击development并单击,Rebase HEAD to但这不起作用,因为我的 COMMIT 不成功。我如何在 SmartGit 上的分支之间切换?有什么帮助吗?
我遇到了FOSUserBundle的问题,因为每次我使用错误的凭据登录时,我都会得到完整的堆栈跟踪作为错误消息:
错误!异常'Symfony\Component\Security\Core\Exception\BadCredentialsException',在/ var/www/html/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider中显示消息'bad credentials'. PHP:90
这对我来说很难看,所以对用户来说非常难看.所以我正在考虑两个解决方案:改为AJAX登录,我正在努力,但它没有工作或我做错了(将在下面解释)并找到一种方法来改变那个丑陋的消息(我没有得到这个,所以任何建议都会有所帮助).
现在关于第一个解决方案,这就是我所做的:
实现AuthenticationHandler:
<?php
namespace UsuarioBundle\Handler;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Bundle\FrameworkBundle\Routing\Router;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
class AuthenticationHandler
implements AuthenticationSuccessHandlerInterface,
AuthenticationFailureHandlerInterface
{
private $router;
public function __construct(Router $router)
{
$this->router = $router;
}
public function onAuthenticationSuccess(Request $request, TokenInterface $token)
{
if ($request->isXmlHttpRequest()) {
// do I need something here?
} else {
// If the user tried to access a protected resource and was forces to login …Run Code Online (Sandbox Code Playgroud)我正在使用SpBowerBundle来管理我的Symfony2项目上的JS库.它工作到几天前,当我尝试升级包时,我收到此错误:
bower ECONFLICT Unable to find suitable version for moment
Run Code Online (Sandbox Code Playgroud)
bower.json由于我正在使用的软件包版本,我怀疑问题出现在我的文件中.这是上述文件的内容:
{
"name": "AppBundle",
"dependencies": {
"jquery": "latest",
"jquery-migrate": "latest",
"bootstrap": "latest",
"font-awesome": "latest",
"bootstrapvalidator": "master",
"pwstrength-bootstrap": "latest",
"select2": "latest",
"fuelux": "latest",
"moment": "master",
"x-editable": "latest",
"datatables": "latest",
"bootbox": "latest",
"knockout": "latest",
"jquery-file-upload": "latest"
}
}
Run Code Online (Sandbox Code Playgroud)
然后,
我有一个情况,也许解决方案很简单但我找不到出路,所以我需要一些帮助.
我有这个HTML代码:
<div class="modal fade in" id="selectFabricante" tabindex="-1" role="dialog" aria-labelledby="selectFabricante" aria-hidden="false" data-backdrop="static" style="display: block; padding-right: 17px;"><div class="modal-backdrop fade in" style="height: 611px;"></div>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Cerrar</span></button>
<h4 class="modal-title">Seleccione uno o más fabricantes</h4>
</div>
<div class="modal-body">
<form id="fabForm" method="post" class="form-horizontal bv-form" novalidate="novalidate"><button type="submit" class="bv-hidden-submit" style="display: none; width: 0px; height: 0px;"></button>
<div class="form-group">
<div class="table-responsive">
<table class="table table-condensed">
<thead>
<tr>
<th><input type="checkbox" id="toggleChkSelFabricante" name="toggleChkSelFabricante"></th>
<th>Fabricante</th>
</tr>
</thead>
<tbody id="selFabricanteBody"><tr data-idproductosolicitud="1" data-id="1"><td><div class="checkbox"><label><input type="checkbox" name="fabLinkChoice[]" value="1"></label></div></td><td>Dist1</td><td>DR</td><td …Run Code Online (Sandbox Code Playgroud) 我有一个问题,我不知道为什么,也许我做错了.我在同一个文件中工作,其他开发人员也正在研究它.他告诉我,文件被推送到存储库,好吧.在进行更改之前,我进行了提交,因此我的更改已保存并与来自其他开发人员的更改合并,但令文件惊讶的是给了我冲突,我不知道该做什么不放弃其他开发人员的更改和地雷.如果我右键单击=>解决冲突我得到了这个窗口:

每种选择意味着什么?哪一个更安全并保存两个更改?(开发商和矿山)
如果我打开Conflict solver然后我得到这样的东西:

但我又不知道如何做或怎样做以保持这两个变化,任何建议?救命?
我正在尝试使用构建应用程序grunt build,我收到此错误:
# grunt build
Running "clean:dist" (clean) task
Running "wiredep:app" (wiredep) task
Running "wiredep:sass" (wiredep) task
Running "includeSource:dist" (includeSource) task
File "dist/index.html" created.
Running "useminPrepare:html" (useminPrepare) task
Configuration changed for concat, uglify, cssmin
Running "concurrent:dist" (concurrent) task
>> Warning: There are more tasks than your concurrency limit. After this limit
>> is reached no further tasks will be run until the current tasks are
>> completed. You can adjust the limit in the concurrent task options
Warning: …Run Code Online (Sandbox Code Playgroud) 我需要<script>...</script>通过其内容和/或其 src 属性删除脚本标记 ( )。以此为例:
<script type="text/javascript">
var adfly_id = 2776246;
</script>
<script src="https://cdn.adf.ly/js/display.js"></script>
Run Code Online (Sandbox Code Playgroud)
我试过这个代码:
jQuery(document).ready(function($){
$('script').each(function() {
if (this.src === 'https://cdn.adf.ly/js/display.js') {
$(this).remove();
}
});
});
Run Code Online (Sandbox Code Playgroud)
但没有成功(我在 WP 中使用该代码 - 如果有人问为什么使用 jQuery 语法),谁能给我一些建议?
编辑:这里的想法是删除脚本以防止其执行
我有一个加载大量数据的灯具,并且我遇到这个错误的所有时间:
致命错误:第65行的/var/www/html/platform-cm/vendor/doctrine/dbal/lib/Doctrine/DBAL/Logging/DebugStack.php中允许的内存大小为2147483648字节(尝试分配16777224字节)
[Symfony\Component\Debug\Exception\OutOfMemoryException]错误:允许的内存大小为2147483648字节耗尽(尝试分配16777224字节)
经过研究后,我发现这篇文章,我读到日志记录可能是问题的原因,因为AppKernel默认情况下将debug设置为true,然后SQL命令在每次迭代时都存储在内存中.
没有禁用调试的第一次尝试AppKernel是运行命令:
doctrine:fixtures:load --no-debug
Run Code Online (Sandbox Code Playgroud)
但是由于同样的错误,我也没有好运.
第二次尝试是禁用调试,config_dev.yml但不建议这样做,因为我正在获取每个日志,但两个都没有工作.
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
# console:
# type: console
# bubble: false
# verbosity_levels:
# VERBOSITY_VERBOSE: INFO
# VERBOSITY_VERY_VERBOSE: DEBUG
# channels: ["!doctrine"]
# console_very_verbose:
# type: console
# bubble: false
# verbosity_levels:
# VERBOSITY_VERBOSE: NOTICE
# VERBOSITY_VERY_VERBOSE: NOTICE
# VERBOSITY_DEBUG: DEBUG
# channels: ["doctrine"]
Run Code Online (Sandbox Code Playgroud)
所以,这就是我的夹具的样子:
class LoadMsisdn extends AbstractFixture implements OrderedFixtureInterface
{
public function getOrder()
{
return …Run Code Online (Sandbox Code Playgroud) 我已经为单元测试编写了这段代码:
<?php
namespace tests;
use data\address\Address;
use lists\Collection;
use PHPUnit\Framework\TestCase;
class CollectionTest extends TestCase
{
public function testIsCollectionOf()
{
$Collection = new Collection(Address::class);
$this->assertInstanceOf($Collection, Collection::class);
}
}
Run Code Online (Sandbox Code Playgroud)
当我跑过它时,我得到了这个错误:
PHPUnit 5.4.6 by Sebastian Bergmann and contributors.
Runtime: PHP 7.0.6-6+donate.sury.org~trusty+1
Configuration: /var/www/project/phpunit.xml
E 1 / 1 (100%)
Time: 33 ms, Memory: 2.00MB
There was 1 error:
1) tests\CollectionTest::testIsCollectionOf
PHPUnit_Framework_Exception: Argument #1 (No Value) of PHPUnit_Framework_Assert::assertInstanceOf() must be a class or interface name
/var/www/project/vendor/phpunit/phpunit/src/Util/InvalidArgumentHelper.php:30
/var/www/project/vendor/phpunit/phpunit/src/Framework/Assert.php:1323
/var/www/project/tests/CollectionTest.php:19
/var/www/project/vendor/phpunit/phpunit/src/Framework/TestCase.php:1081
/var/www/project/vendor/phpunit/phpunit/src/Framework/TestCase.php:932
/var/www/project/vendor/phpunit/phpunit/src/Framework/TestResult.php:701
/var/www/project/vendor/phpunit/phpunit/src/Framework/TestCase.php:888
/var/www/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php:753
/var/www/project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:465
/var/www/project/vendor/phpunit/phpunit/src/TextUI/Command.php:162 …Run Code Online (Sandbox Code Playgroud)