草庐IT

collection_list

全部标签

php - 使用 Laravel Collection 获取重复值

我不想删除重复值,我想获取articles_id重复项并将它们的数量值相加,例如,这是我的收藏:Collection{#306▼#items:array:3[▼0=>CartLine{#294▼+quantity:2+article_id:1728+article_name:"TAZACERAMICA"}1=>CartLine{#296▼+parent_line_id:null+quantity:1+article_id:1728+article_name:"TAZACERAMICA"}2=>CartLine{#298▼+quantity:1+article_id:1378+artic

php - Symfony2 表单集合 : How to remove entity from a collection?

我尝试从集合中删除实体,但它不起作用。我想我在某处有错误,但我不知道在哪里。这是我的updateAction中的代码:$em=$this->getDoctrine()->getEntityManager();$entity=newPerson();if(!$entity){throw$this->createNotFoundException('UnabletofindPersonentity.');}$editForm=$this->createForm(newPersonType(),$entity);$deleteForm=$this->createDeleteForm($id)

php - 在 list.phtml 中显示产品属性 - Magento

你好,我已经阅读了很多关于这个的帖子,虽然它有效但还不完整。例如;属性1=鞋码,属性2=鞋颜色。两者都在下拉列表中,我想在类别页面中列出每个产品的所有可能属性颜色。问题:当我测试代码时,它只会显示第一种鞋子颜色,而不是所有可能的颜色。我在这里做错了什么?这是我所拥有的3个示例。所有代码都有效,但只显示第一个属性颜色。示例1:getMyAttribute()?>getAnotherCustomAttribute()?>getAttributeText('shoecolor')?>示例2getResource()->getAttribute('shoecolor')->getFronten

php - 如何刷新使用 phar.cache_list 指令缓存的 phar?

我将我的phar添加到cache_listphp.ini中的指令和缓存效果很好。几天后我更新了phar现在我收到以下错误:Warning:Phar::webPhar(phar:///usr/share/app/app.phar/www.php):failedtoopenstream:pharerror:internalcorruptionofphar"/usr/share/app/app.phar"(crc32mismatchonfile"www.php")in/usr/share/app/app.pharonline8如果我注释掉cache_list指令,phar可以正常工作并加载,

php - Magento soap api catalog_product.list 分页

我目前正在使用Magentoapi,我需要你们的帮助,我有1200种产品需要在页面中列出……(所有类别的所有产品)我用$this->magento_api->call($session,'catalog_product.list');它也很好用..列出所有产品。但是现在……我遇到了问题,因为……一页1200个产品有点太多了……所以我想知道是否有可能获得……也许……25/50产品并创建分页?感谢您的帮助, 最佳答案 查看此答案:https://stackoverflow.com/a/7797226/612717基本上,您必须将指定fr

php - 扁平化 Laravel Eloquent Collection 关系

我正在使用以下数据库结构:电影-编号-标题导演-编号-姓名电影导演-director_id-电影编号模型是这样设置的:电影.phpnamespaceApp;useIlluminate\Database\Eloquent\Model;classMovieextendsModel{public$table="movie";/***Therolesthatbelongtotheuser.*/publicfunctiondirectors(){return$this->belongsToMany('App\Director','movie_director');}}Director.phpna

php - Symfony2 : Removing entity from middle of collection

1。概述我希望能够使用symfony2Form从集合中删除一个实体。1.1问题我可以向集合中添加和删除新实体,只要添加或删除的实体位于集合的末尾。一旦我从开头或中间删除一个,我就会收到以下错误:当我尝试执行此操作时出现此错误:Neithertheproperty"id"noroneofthemethods"addId()"/"removeId()","setId()","id()","__set()"or"__call()"existandhavepublicaccessinclass"ApiBundle\Entity\Data\Column".1.2代码这是所有相关代码。数据/***

java - jackson 序列化 Collections.unmodifiable*

我在使用来自json的Jackson序列化时遇到问题,如何从Collections.unmodifiableMap序列化?我得到的错误是:com.fasterxml.jackson.databind.JsonMappingException:Cannotconstructinstanceofjava.util.Collections$UnmodifiableMap,problem:Nodefaultconstructorfound我想使用http://wiki.fasterxml.com/SimpleAbstractTypeResolver中的SimpleAbstractTypeRes

java - 使用 mapstruct 从 List<Object> 映射 List<String>

您好,我在使用mapstruct从子源类中设置DTO中的List操作时得到null。有人可以帮我解决这个问题吗?请在这里找到我的代码实体类:publicclassSource{intid;Stringname;ListchildSource;//gettersandsetters}publicclassChildSource{Stringcode;Stringaction;//gettersandsetters}目的地DTO:publicclassTargetDTO{intsNo;StringmName;Listactions;//gettersandsetters}MApper类:@

java - Jersey JAXB 如何为 List 实现 MessageBodyWriter

我正在尝试为List实现MessageBodyWriter。通过这个实现,我在线上有一个空指针异常;marshaller.marshal(o,entityStream);@Provider@Produces(MediaType.APPLICATION_XML)publicclassMyListProviderimplementsMessageBodyWriter>{privateStringmyWrapElemName="datas";privateMarshallermarshaller;publicInstrumentModelListProvider(){JAXBContextc