我正在通过 cURL 调用 API 方法,我得到了这个响应:
<?xml version="1.0" encoding="UTF-8"?>
<jobInfo
xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<id>75080000002s5siAAA</id>
<operation>query</operation>
<object>User</object>
<createdById>00580000008ReolAAC</createdById>
<createdDate>2015-06-23T13:03:01.000Z</createdDate>
<systemModstamp>2015-06-23T13:03:01.000Z</systemModstamp>
<state>Open</state>
<concurrencyMode>Parallel</concurrencyMode>
<contentType>CSV</contentType>
<numberBatchesQueued>0</numberBatchesQueued>
<numberBatchesInProgress>0</numberBatchesInProgress>
<numberBatchesCompleted>0</numberBatchesCompleted>
<numberBatchesFailed>0</numberBatchesFailed>
<numberBatchesTotal>0</numberBatchesTotal>
<numberRecordsProcessed>0</numberRecordsProcessed>
<numberRetries>0</numberRetries>
<apiVersion>34.0</apiVersion>
<numberRecordsFailed>0</numberRecordsFailed>
<totalProcessingTime>0</totalProcessingTime>
<apiActiveProcessingTime>0</apiActiveProcessingTime>
<apexProcessingTime>0</apexProcessingTime>
</jobInfo>
Run Code Online (Sandbox Code Playgroud)
我想以一种简单的方式访问|解析该结果,但我不知道是否应该反序列化 XML 或只是尝试使用一些 PHP 原生 XML 函数来读取它。那么关于这个第一个疑问的想法?
如果反序列化 XML 更好,那么我已经阅读了这篇文章 “在 Symfony2 中使用 JMSSerializerBundle 反序列化 XML”,并且我根本不清楚是否需要一个实体来实现这一点。还有这个其他主题,仍然让我感到困惑。对此有何建议?经验?建议?
我有一个列viewedAt是a DATETIME并接受NULL值.在每条新记录上设置该列是一个软件限制,0000-00-00 00:00:00因此我使用Symfony和Doctrine进行简单的操作,如下所示:
$entEmail = new Email();
$entEmail->setViewedAt(new \DateTime('0000-00-00 00:00:00'));
Run Code Online (Sandbox Code Playgroud)
但令人惊讶的是PHP改变了这个日期-0001-11-30 00:00:00,MySQL服务器中的SQL模式设置为STRICT,因此查询失败.我已阅读主题的LOF这里这个,这个和其他一些,但没有回答我的疑问都没有.我已经用PHP做了一些测试,我得到了几乎相同的结果:
$date = new DateTime("0000-00-00 00:00:00", new DateTimeZone('America/New_York'));
echo $date->format('Y-m-d h:i:s');
// outputs
// -0001-11-30 12:00:00
Run Code Online (Sandbox Code Playgroud)
即使设置了MySQL模式,STRICT我也测试了以下查询,它的工作方式如下图所示:
INSERT INTO emails(`emails_category`, `deliveredAt`, `viewedAt`, `data`, `createdAt`, `updatedAt`, `reps_id`, `targets_id`) VALUES ("sent","2015-10-29 06:08:25","0000-00-00 00:00:00",null,"2015-10-29 06:08:25","2015-10-29 06:08:25","005800000058eYcAAI","0018000001GO8omAAD")
Run Code Online (Sandbox Code Playgroud)
因此,viewedAt在接受0000-00-00 00:00:00该值,即使是无效的(我认为这是一种空左右)
我怎么解决这个问题?有什么工作吗?在这个软件要求无法更改的特定情况下,您对我提出了什么建议?
我正在使用Symfony 2.7.6,Doctrine 2.5.2和PHP 5.5.30
我有这个CSS样式:
body {
padding: 0;
margin: 0;
font-family: bentonsans-regular, sans-serif;
font-size: 14px;
background-image: url(../affiliate/amex/images/background.png);
background-repeat: repeat-y;
background-position: top left;
}
#header {
position: fixed;
left: 150px;
top: 50px;
}
#footer {
position: fixed;
left: 150px;
right: 50px;
bottom: 10px;
height: 100px;
line-height: 10px;
font-size: 10px;
}
Run Code Online (Sandbox Code Playgroud)
我需要改变它们px,%但我不知道如何以准确的方式实现这一目标.我发现这个转换为px,em但这不是那么有用.网站有人能指出我正确的方向吗?有任何想法吗?建议?解决方案?
我正在尝试从master分支签出我的代码的旧版本,我正在执行以下操作:
git checkout -b master_de1974 `git rev-list -n 1 --before="5 days ago" master`
Run Code Online (Sandbox Code Playgroud)
这是正确的命令吗?我如何确定我是否获得旧代码而不是新代码?
我有以下HTML表单:
<form id="some_id">
<select id="select1">...</select> // this turns in a Select2 component
<select id="select2">...</select> // this turns in a Select2 component
<select id="select3">...</select>
<input type="text" name="inp1" id="inp1" />
</form>
Run Code Online (Sandbox Code Playgroud)
我试图通过AJAX发送它如下:
$.ajax({
type: 'post',
url: '/save',
data: $('#new_component_restriction').serialize(),
success: function () {
alert('form was submitted');
}
});
Run Code Online (Sandbox Code Playgroud)
但是只有输入是在POST请求上发送的,为什么呢?我在这里遗失了什么?我是否需要获取SELECT的值并发送?
我有一个来自PHP端的结果,json_encode并将所有值作为字符串发送(而不是它的原始类型).来的字符串quote_tax是a 1|0,当然这是true|false例如:
{
"country_id": "3",
"country_name": "Italy",
"contract_tax": "1",
"quote_tax": "0",
"contract_inflation": "0",
"quote_inflation": "0"
}
Run Code Online (Sandbox Code Playgroud)
当我想基于这样的值执行某些操作时,因为它们以字符串形式出现,我需要做这样的事情:
data.quote_tax == '1'
? $('#contract_tax').val(1).attr('checked', 'checked')
: $('#contract_tax').val(0).removeAttr('checked');
Run Code Online (Sandbox Code Playgroud)
我确实知道.parseInt()将它们转换为整数,但我相信那时我需要进行相同的比较但是这种情况比较INT:
data.quote_tax == 1
? $('#contract_tax').val(1).attr('checked', 'checked')
: $('#contract_tax').val(0).removeAttr('checked');
Run Code Online (Sandbox Code Playgroud)
我试过这种方式:
Boolean(data.quote_tax) == true
? $('#contract_tax').val(1).attr('checked', 'checked')
: $('#contract_tax').val(0).removeAttr('checked');
Run Code Online (Sandbox Code Playgroud)
它不起作用,因为Boolean(data.quote_tax)总是评价true即使data.quote_tax = '0'.
我已经检查了这些帖子,但我找不到合适的解决方案:
任何想法在这里有什么问题或如何做到这一点?
我在以下服务定义IntegrationBundle/Resources/config/services.yml:
services:
event.subscriber.params.extractor:
class: IntegrationBundle\Middleware\EventSuscriberParamsExtractor
main.api:
class: IntegrationBundle\API\MainAPI
calls:
- [setContainer, ['@service_container']]
order.push.api:
class: IntegrationBundle\API\OrderPushAPI
calls:
- [setContainer, ['@service_container']]
process.account.api:
class: IntegrationBundle\API\ProcessAccountData
arguments:
- '@event.subscriber.params.extractor'
calls:
- [setContainer, ['@service_container']]
...
Run Code Online (Sandbox Code Playgroud)
我需要main.api从一个Symfony命令中访问,这就是我的操作方式:
namespace IntegrationBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Command\LockableTrait;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class SchneiderAPICommand extends ContainerAwareCommand
{
use LockableTrait;
protected function configure()
{
$this
->setName('api:execute')
->setDefinition(
new InputDefinition([
new InputOption('source', '', InputArgument::OPTIONAL, '', 'Wonderware'),
new InputOption('object', '', InputArgument::OPTIONAL, '', 'Account,AgreementHistory'),
new …Run Code Online (Sandbox Code Playgroud) 我想创建一个 Symfony 项目。我和很多人一样有关于 php 版本的问题:Symfony 使用了错误的版本。
\n\n\xce\xbb php -version\nPHP 7.4.1 (cli) (built: Dec 17 2019 19:24:02) ( ZTS Visual C++ 2017 x64 )\nCopyright (c) The PHP Group\nZend Engine v3.4.0, Copyright (c) Zend Technologies\n\n\xce\xbb symfony -V\nSymfony CLI version v4.12.4 (Tue Jan 14 13:09:08 UTC 2020)\n\n\xce\xbb symfony check:requirements\n\nSymfony Requirements Checker\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n> PHP is using the following php.ini file:\nC:\\xampp\\php\\php.ini\n\n> Checking Symfony requirements:\n\n..............WWW......W..\n\n\n [OK]\n Your system is ready to run Symfony projects\nRun Code Online (Sandbox Code Playgroud)\n\n我安装了 Xampp,但我在 Windows 10 上使用 Laragon 7.4.1,并希望使用该版本,但 Symfony 告诉我:
\n\n\xce\xbb …Run Code Online (Sandbox Code Playgroud) 我有以下数组结构:
const values = [{
"region": "US", "content": "content 1", "value": "value1"
}, {
"region": "US", "content": "content 2", "value": "value2"
}, {
"region": "US", "content": "content 3", "value": "value3"
}, {
"region": "LA", "content": "content 4", "value": "value4"
}, {
"region": "LA", "content": "content 5", "value": "value5"
}, {
"region": "LA", "content": "content 6", "value": "value6"
}, {
"region": "LA", "content": "content 7", "value": "value7"
}]
Run Code Online (Sandbox Code Playgroud)
我正在尝试将其转换为以下内容 - 请注意,region密钥已从输出数组内的结果对象中消失:
const output = [{
"US": [
{"content": "content …Run Code Online (Sandbox Code Playgroud) 我Timestampable在我的实体中添加了如下支持:use Gedmo\Timestampable\Traits\TimestampableEntity;.我已经通过运行更新了我的数据库,doctrine:schema:update --force但是当我尝试插入新记录时,我收到此消息:
SQLSTATE [23502]:非空违规:7错误:"createdat"列中的空值违反非空约束
为什么?我正在使用最新的Symfony 2.5.3和PostgreSQL 9.2.9.这是完整的错误:
在执行"INSERT INTO usuarios_externos.usuarios(用户名,username_canonical,电子邮件,email_canonical,启用,盐,密码,LAST_LOGIN,锁定,过期expires_at,confirmation_token,password_requested_at,角色,credentials_expired,credentials_expire_at,ID,角色,correo_alternativo发生异常, telefono,telefono_movil,传真,pagina_web,direccion,deletedAt,createdAt,updatedAt,pais_id,estado_id,municipio_id,ciudad_id,parroquia_id)VALUES(?,?,?,?,?,?,?,?,?,?,?,带有参数["reynier"的?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', "reynier","reynierpm@gmail.com","reynierpm@gmail.com","false","hhm95if1uog88koggos48csk48k0w80","sVzbTOHgZzhU92zPHBFsVG3GqV + DO5xvXxvNdC5/GVJ/Hnvlm8rBsNDsIgPKYXdZ4NcnONqXnrOB6UR + lAluAw ==",null,"false","false" ",null,null,null,"a:0:{}","false",null,3,"true","reynierpm1 @ gmail.com","021245678999","","","", "sadasdasd",null,null,null,23,1,1,1,22]
有什么建议?
添加实体
<?php
use FOS\UserBundle\Model\User as BaseUser;
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="usuarios_externos.usuarios", schema="usuarios_externos")
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false)
*/
class Usuario extends BaseUser
{
....
/**
* @var datetime $created
*
* @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/
private $created;
/**
* @var datetime $updated
*
* @Gedmo\Timestampable(on="update") …Run Code Online (Sandbox Code Playgroud) php ×5
symfony ×5
doctrine-orm ×2
html ×2
javascript ×2
jquery ×2
ajax ×1
arrays ×1
css ×1
css3 ×1
datetime ×1
forms ×1
git ×1
git-checkout ×1
laragon ×1
postgresql ×1
symfony-3.2 ×1
xampp ×1
xml ×1