有没有更优雅的解决方案来达到与此相同的效果?

我到目前为止的代码是这样的:
<!DOCTYPE html>
<html>
<head>
<title>Table Test</title>
<style type="text/css">
table { border-collapse: collapse; }
td { border: solid 1px; }
td.nest { padding: 0px; }
td.nest table td { border-width: 0px 1px; }
td.nest table td:first-child { border-left: none; }
td.nest table td:last-child { border-right: none; }
</style>
</head>
<body>
<table>
<colgroup>
<col style="width: 3em;"/>
<col style="width: 6em;"/>
<col style="width: 9em;"/>
</colgroup>
<tr><td>1</td><td>2</td><td>3</td></tr>
<tr><!-- Somehow get rid of the nested table and keep just the tds -->
<td class="nest" …Run Code Online (Sandbox Code Playgroud) 我在一个盒子里有一些很长的<option>s <select>,但我不希望盒子太宽。问题是当我将框设置得较小时,无法阅读全文。我正在考虑将文本副本恰好悬停在鼠标指针所在的选项上,但前提是文本太长而无法完全显示。
但是,如果我创建一个新元素,比如<p>使用 jQuery 创建一个新元素,它在将其插入文档之前没有宽度,因此我无法决定是否插入它。
即使我确实成功创建了它,我也不确定所有样式都会相同。
有没有办法让这个想法发挥作用,或者有没有更好的方法来<option>就地显示 long 的完整文本?
this.afs
.collection('userroutes' + cityid, ref =>
ref.where(
'requestList',
'array-contains',
'str'
)
)
.valueChanges()
.subscribe(data => {
//I get the data
//this works
});`
Run Code Online (Sandbox Code Playgroud)
不工作
this.afs
.collection('userroutes' + cityid, ref =>
ref.where(
'requestList.id', <-- in case of object search what it will
'array-contains',
'ED8r2DWAcyM0sKJiAJxwwAVDm2q2'
)
)
.valueChanges()
.subscribe(data => {
//this do not give any data....
//though this id is present id firebase db
});
Run Code Online (Sandbox Code Playgroud)
不工作
this.afs
.collection('userroutes' + cityid, ref =>
ref.where(
'requestList', <-- in case of object search what …Run Code Online (Sandbox Code Playgroud) 我有这样的实体如下
class item
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="integer",nullable=true)
*/
private $errorNum;
public function getErrorNum()
{
return $this->errorNUm * 3;
}
Run Code Online (Sandbox Code Playgroud)
在将实体传递给twig之后,我可以像这样访问twig中的errorNum.
{{ item.errorNum }}
Run Code Online (Sandbox Code Playgroud)
但是我想从twig中访问getErrorNum.
我该怎么做?
我刚刚实现了一个自定义错误trigger_error(),但问题是调用的行trigger_error()显示为调用堆栈跟踪中的违规行,而不是调用行.
<?php
trait ClassProtection {
public function __get($name) {
$class_name = get_called_class();
trigger_error("Public property {$class_name}::\${$name} does not exist", E_USER_ERROR);
}
public function __set($name, $value) {
$class_name = get_called_class();
trigger_error("Public property {$class_name}::\${$name} does not exist and automatic creation has been disabled", E_USER_ERROR);
}
}
class SomeClass {
use ClassProtection;
public $foo = 1;
protected $bar = 2;
private $baz = 3;
}
$sc = new SomeClass;
// Try to access existing public property: should work
var_dump($sc->foo);
$sc->foo …Run Code Online (Sandbox Code Playgroud) 我不明白以下问题:
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]您必须设置php-http/httplug-bundle才能使用默认的http客户端服务.
脚本Sensio\Bundle\DistributionBundle\Composer\ScriptHandler :: clearCache处理以异常终止的post-update-cmd事件[RuntimeException]执行"'cache:clear --no-warmup'">命令时发生错误:
[ Symfony\Component\Config\Definition\Exception\InvalidConfigurati
onException]
您必须设置php-http/httplug-bundle才能使用默认的http客户端服务.
下面是我的文件composer.json
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/", "SymfonyStandard": "app/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.8.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "dev-master",
"doctrine/doctrine-fixtures-bundle": "dev-master",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"sonata-project/admin-bundle": "~2.3@dev",
"sonata-project/doctrine-orm-admin-bundle": "2.3.4",
"knplabs/knp-disqus-bundle": "dev-master",
"hwi/oauth-bundle": "dev-master",
"kartik-v/bootstrap-star-rating": "dev-master",
"azine/socialbar-bundle": "dev-master",
"gregwar/captcha-bundle": "dev-master",
"knplabs/knp-paginator-bundle": "~2.4",
"php-http/guzzle6-adapter": "1.1.1",
"php-http/httplug-bundle": "1.7.1" …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Codeception在测试工具中使用Symfony控制器。每种方法的开始如下:
public function saveAction(Request $request, $id)
{
// Entity management
/** @var EntityManager $em */
$em = $this->getDoctrine()->getManager();
/* Actual code here
...
*/
}
public function submitAction(Request $request, $id)
{
// Entity management
/** @var EntityManager $em */
$em = $this->getDoctrine()->getManager();
/* 200+ lines of procedural code here
...
*/
}
Run Code Online (Sandbox Code Playgroud)
我试过了:
$request = \Symfony\Component\HttpFoundation\Request::create(
$uri, $method, $parameters, $cookies, $files, $server, $content);
$my_controller = new MyController();
$my_controller->submitAction($request, $id);
Run Code Online (Sandbox Code Playgroud)
从我的单元测试来看,但是似乎还有很多其他设置我不知道Symfony在后台执行。每当我找到一个丢失的对象并将其初始化时,就会有另一个在某个时刻失败。
我也尝试过逐步从PhpStorm进行测试,但是PhpUnit的某些输出会导致Symfony在它接近我要测试的代码之前就死掉,因为它无法在$_SESSION发生任何输出后启动。我不认为这是从命令行发生的,但是我还不够接近。
如何在单元测试中简单且可扩展地运行此代码?
一点背景:
我继承了这段代码。我知道它很脏而且有异味,因为它正在控制器中执行模型逻辑。我知道我要的不是“纯粹的”单元测试,因为它实际上涉及整个应用程序。
但是我需要能够自动运行这一小段(200行以上)的代码。该代码应在不超过几秒钟的时间内运行。我不知道要多久,因为我从未能够独立运行它。
当前,通过网站运行此代码的设置时间非常长,而且很复杂。该代码不会生成网页,基本上是生成文件的API调用。在进行代码更改时,我需要能够在短时间内生成尽可能多的这些测试文件。
代码就是它。能够对其进行更改是我的工作,现在我什至每次都没有大量开销就无法运行它。在不知道它在做什么的情况下进行更改是不负责任的。
截至 2018 年 9 月 19 日,Sourcetree for Mac 的最新版本是 2.7.6。您可以在Sourcetree 2.7.6 变更日志中看到,钥匙串问题多年来一直困扰着 Mac 应用程序。
如果我允许 Sourcetree 将远程密码(例如 Github、Bitbucket)保存在钥匙串中,则所有连接到该服务的尝试都会失败。如果我随后检查 Sourcetree 中的帐户设置,帐户密码已更改为钥匙串密码(只有它们的长度不同才能看出)。
Sourcetree > 首选项... > 帐户 > 编辑... >(“密码:”字段的内容)
到目前为止,我知道的唯一解决方法是从钥匙串中删除该 Git 服务的 Sourcetree 条目,并防止 Sourcetree 每次询问时都保存密码。不幸的是,这意味着我每次都必须重新输入密码,并取消选中“将密码存储在钥匙串中”。
我希望唯一的解决方案是等待解决问题的更新,但这个问题是提供规范的参考。
我想为我的网站创建一个投票和投票系统,其中一个独特的用户可以在一个帖子上/下投票,下次他只允许相反从数据库下车,之后他再次可以上下投票.
在这种情况下,我有:
用户表:
id
name
Run Code Online (Sandbox Code Playgroud)
辩论表:
id
post
Run Code Online (Sandbox Code Playgroud)
upvotes表:
id
user_id
debate_id
Run Code Online (Sandbox Code Playgroud)
和类似的downvote表:
id
user_id
debate_id
Run Code Online (Sandbox Code Playgroud)
这是管理和跟踪投票和投票概念的好方法吗?
php ×5
symfony ×3
css ×2
html ×2
.net ×1
c# ×1
codeception ×1
eloquent ×1
firebase ×1
forms ×1
html-table ×1
javascript ×1
jquery ×1
laravel ×1
macos ×1
mysql ×1
phpunit ×1
reflection ×1
security ×1
stack-trace ×1
twig ×1
unit-testing ×1