草庐IT

delete_existing

全部标签

php - 奏鸣曲管理员 - sonata_type_collection : select from the list of existing entities

我正在尝试使用PageHasImage桥接实体在Page和Image实体之间实现多对多关系。在PageAdmin中,我添加了如下字段:->add('galleryImages','sonata_type_collection',array('cascade_validation'=>false,'by_reference'=>false,'type_options'=>array('delete'=>false)),array('edit'=>'inline','inline'=>'table','sortable'=>'position','admin_code'=>'sonata.

php - 银条 3 : the method 'fortemplate' does not exist on 'File'

我正在为我的页面创建一个GridField,它与我的DataObjects有一个has_many关系,但是在添加数据并保存对象后它会中断CMS中的页面。搜索后我无法弄清楚原因或找不到任何答案。这是错误和我的代码:[UserError]UncaughtException:Object->__call():themethod'fortemplate'doesnotexiston'File'ProductPage.phpclassProductPageextendsPage{//Contactobject'sfieldspublicstatic$db=array('ProductPrice'

php - Laravel delete() 静态调用

我遇到了这个错误:Non-staticmethodIlluminate\Database\Eloquent\Model::delete()shouldnotbecalledstatically,assuming$thisfromincompatiblecontext这是我Controller中的代码:$file_db=newFile();$file_db=$file_db->where('id',$id)->find($id);$file_db=$file_db->delete();有人可以解释我做错了什么以及如何正确调用它吗? 最佳答案

php - 如何在 DELETE QUERY 中编写 LEFT JOIN?

你能给我一个使用Doctrine的左连接的删除查询的例子吗? 最佳答案 这是不可能的。看到:http://trac.doctrine-project.org/ticket/2142您必须在where子句中使用子查询:http://www.doctrine-project.org/documentation/manual/1_2/en/dql-doctrine-query-language:subqueries尝试这样的事情:$q=Doctrine_Query::create()->delete('TableBb')->where('

php - 拉维尔 4 : Will a soft delete on a table also apply to it relationships

我有一个名为'Titles'的表,我将向它添加软删除,但它还有几个引用此'Titles'表的其他表:目前,如果我删除一个标题,它将在标题详细信息处自动从所有其他引用的表格中删除。因此,如果我在执行删除时向'Titles'表添加软删除,它会在'titles'表上执行软删除,但会从引用表中删除详细信息?或者它会忽略onDeleteCascade请求并保留引用的数据吗?如果是第一个选项,那么我需要添加一个$table->softDeletes();到所有表引用。以及将protected$softDelete=true;添加到他们的模型中? 最佳答案

php - Symfony2 : The option "widget" does not exist

我正在尝试使用symfony2构建表单,但每当我添加小部件选项以指定表单字段类型时,我总是收到错误消息“选项“小部件”不存在”。我正在按照那里的文档给出的示例http://symfony.com/doc/current/book/forms.html我的代码不起作用。classUserTypeextendsAbstractType{publicfunctionbuildForm(FormBuilder$builder,array$options){$builder->add('Name')->add('Login')->add('Password')//,'text',array('w

php - mock & PHPUnit : method does not exist on this mock object

你能告诉我问题出在哪里吗?我有一个包含以下测试的GeneratorTest.php文件:shouldReceive('put')->with('foo.txt','foobar')->once();$generator=newGenerator($fileMock);$generator->fire();}publicfunctiontestGeneratorDoesNotOverwriteFile(){$fileMock=\Mockery::mock('\stats\jway\File');$fileMock->shouldReceive('exists')->once()->and

php - 在 PUT、PATCH、DELETE ... 请求中使用 php 读取 multipart/form-data 的原始请求正文

我正在从头开始编写一个restfulapi库,现在我遇到了一个常见问题:从请求中读取来自multipart/form-data的原始数据。对于POST请求,我知道我应该使用$_FILE/$_POST变量。但是,如果存在PUT、PATCH或除POST之外的任何请求类型怎么办?这种情况可能吗?如果是这样,我如何阅读原始body内容,因为,根据documentation它不是在php://input中可用吗?注意:我已经搜索了输入格式以及如何读取它,我只想访问RAW数据。 最佳答案 ButwhatifthereisaPUT,PATCH,o

php - 与 Symfony2 AsseticBundle 和 'non existing routes' 冲突

Assetic不适用于此标签:{%stylesheetsoutput='/style/app.css''@VendorBundle/Resources/style/main.css'%}{%endstylesheets%}如果我使用它,就像Assetic不知道如何处理它一样。在config_devuse_controller中为真。我找不到我做错了什么。我刚明白:Anexceptionhasbeenthrownduringtherenderingofatemplate("UnabletogenerateaURLforthenamedroute"_assetic_aca6c7a_0"as

php - "Request does not exist"创建表单 symfony2

我是php和symfony2的菜鸟。我正尝试按照教程http://symfony.com/doc/current/book/forms.html创建一个表单和其他一些教程。我收到“500内部错误”,我不知道我什么时候失败了,我正在伤脑筋。需要帮助,请日志:[2015-10-1623:35:27]request.INFO:Matchedroute"nueva_serie".{"route_parameters":{"_controller":"Acme\\AxialBundle\\Controller\\SeriesController::nuevaAction","_route":"n