我有2个捆绑包,我想在另一个中覆盖其中一个的存储库:
我有一个源包:SourceBundle。我有我的替代捆绑包:OverrideBundle
首先,在OurVendorOverrideBundle.php中,我添加了:
public function getParent()
{
return 'SomeVendorSourceBundle';
}
Run Code Online (Sandbox Code Playgroud)
然后
我想为SourceBundle实体的存储库添加一个自定义方法。源实体是Response.php,其存储库是ResponseRepository.php
所以我做了 :
<?php
namespace OurVendor\OverrideBundle\Repository;
use Doctrine\ORM\EntityRepository;
use SomeVendor\SourceBundle\Repository\ResponseRepository as BaseRepository;
class ResponseRepository extends BaseRepository
{
/**
*
* @return array
*/
public function getQueryExerciseAllResponsesForAllUsers($exoId)
{
$qb = $this->createQueryBuilder('r');
$qb->join('r.paper', 'p')
->join('p.exercise', 'e')
->where('e.id = ?1')
->andWhere('p.interupt = ?2')
->setParameters(array(1 => $exoId, 2 => 0));
return $qb->getQuery();
}
}
Run Code Online (Sandbox Code Playgroud)
如果我没有在OverrideBundle中设置Entity,则会出现此错误:
The autoloader expected class "CPASimUSante\ExoverrideBundle\Entity\Response" to be defined in file "/home/www/myproject/vendor/ourvendor/override-bundle/OurVendor/OverrideBundle/Entity/Response.php". The file was found but the class …Run Code Online (Sandbox Code Playgroud) 这是测试:
$(function() {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'column'
},
title: {
text: 'Long xAxis legends',
},
xAxis: {
categories: ['a long category name', 'another long category name', 'a very long category name', 'Thats enormous', 'short', 'a long category name', 'another long category name', 'a very long category name', 'Thats enormous', 'short'],
labels:{
rotation:90,
y:100,
},
},
series: [
{
name: 'Some values',
data: [10, 20, 53, 2.51, 1.35, 10, 20, 53, …Run Code Online (Sandbox Code Playgroud) 我正在通过 Symfony Bundle knp Snappy bundle使用 wkhtmltopdf ,只要我使用 px 作为大小,它就可以正常工作。但是我需要根据 A4 尺寸生成一张贴纸,但我什么都做不了:我将 wkhtmltopdf 的所有边距设置为 0
$snappy->setOption('margin-top', '0mm');
$snappy->setOption('margin-left', '0mm');
$snappy->setOption('margin-right', '0mm');
$snappy->setOption('margin-bottom', '0mm');
Run Code Online (Sandbox Code Playgroud)
然后在我的测试 html(它是应用程序中的一根树枝)中的一列:我尝试了一个简单的:
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
</head>
<body style="margin:0;padding:0">
<div style="background-color:red;width:99%;height:1400px;border:solid #000 1px">
<div style="background-color:green;display:inline-block;padding:0;margin:0;width:105mm;height:297mm"></div>
<div style="background-color:yellow;display:inline-block;padding:0;margin:0;width:105mm;height:297mm"></div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我也试过英寸:105 => 4.13in, 297mm => 11.69in,结果相同
我也试过直接生成(没有包)
wkhtmltopdf --page-size A4 -B 0 -L 0 -R 0 -T 0 test.html output.pdf
Run Code Online (Sandbox Code Playgroud)
结果相同
为什么 A4 尺寸的一半:105 毫米或 4.13 英寸不起作用?我也试过在 wkhtmltopdf 设置中直接设置页面大小:页面高度和页面宽度而没有改变。
我不能使用百分比,因为使用真实数据我会有更复杂的设置(左右边距、2、3...列)
设置可能有什么问题?这是一个CSS问题吗?wkhtmltopdf 问题?