草庐IT

Doctrine_Query

全部标签

php - mysqli_query 和 mysqli_fetch_assoc 给出错误

我一直在尝试为访问我的index.php文件时发现的mysql错误消息找到解决方法,代码如下:Warning:mysqli_query()expectsparameter1tobemysqli,resourcegivenin/Applications/XAMPP/xamppfiles/htdocs/cms/includes/navigation.phponline24Warning:mysqli_fetch_assoc()expectsparameter1tobemysqli_result,nullgivenin/Applications/XAMPP/xamppfiles/htdocs

php - 如何使用 Eloquent Query Builder 对与同一张表的关系使用 whereHas?

我正在尝试运行此查询:$products=$this->product_model->where(function($query)use($key){$query->whereHas('categories',function($category)use($key){$category->where('key',$key);});$query->orWhereHas('parent.categories',function($category)use($key){return$category->where('key',$key);});});父关系是另一个产品,所以它来自同一个表。我

mysql - 如何在doctrine中进行复杂的SQL查询

我有2个表:用户和他们的积分。用户有字段:编号姓名点有字段:编号开始日期结束日期count_of_points用户ID所以有些用户可能有积分也可能没有积分。点数条目受时间间隔限制(从开始日期到结束日期),并包含用户在此间隔内拥有的点数。我需要显示此时按总点数排序的用户表(时间戳必须在开始日期和结束日期之间)并稍后在View中显示此总和值。如果用户没有积分,则此计数必须等于0。我有这样的东西:$qb=$this->getEntityManager()->getRepository('MyBundle:User')->createQueryBuilder('u');$qb->select(

php - 如何防止 EntityManager (Doctrine Association) 删除

我遇到了以下问题:我有一个与客户一对一、单向关联的实体查询:/***@varCustomer**@ORM\OneToOne(targetEntity="Customer",cascade={"persist"},fetch="EAGER")*@ORM\JoinColumn(name="Customer",referencedColumnName="id",onDelete="SETNULL",nullable=true)*/protected$customer;如果我通过数据库后端(PhpMyAdmin)删除客户,那么一切都很好:客户字段设置为空,但如果我使用EntityManager

mysql - Doctrine 想要 "ALTER TABLE coo_users CHANGE id id VARCHAR(255) NOT NULL;"但每次我更新模式时都想这样做

如果我执行bin/consoledoctrine:schema:update--force结果是:Updatingdatabaseschema...Databaseschemaupdatedsuccessfully!"1"querywasexecuted每次运行update命令时都会执行此操作。因此,使用bin/consoledoctrine:schema:validate我看到了:[Mapping]OK-Themappingfilesarecorrect.[Database]FAIL-Thedatabaseschemaisnotinsyncwiththecurrentmappingf

php - Symfony 中的 Doctrine\ORM\Mapping\MappingException

我得到的完整错误是:[Doctrine\ORM\Mapping\MappingException]Property"followed"in"BackendBundle\Entity\Following"wasalreadydeclared,butitmustbedeclaredonlyonce当我尝试在我的BackendBundle中创建实体时。我在MYSQL中有3个表“empresas”、“tecnicos”、“profesionistas”,下面是每个表的fkCREATETABLEfollowing(idint(255)notnullauto_increment,userint(2

php - 连接两个表时出现 "Message : Undefined Variable:query "错误 codeigniter mysql php

我有两个名为“addexpense”和“addcategory”的表。我已成功加入每个表,但在我的View页面上未查看数据并且屏幕上传递了一条错误消息。请帮忙。这是我的模型publicfunctiongetExpenses(){$this->db->select("addexpense.exp_date,addexpense.exp_amount,addexpense.exp_note,addexpense.exp_created,addcategory.category_name");$this->db->from('addexpense');$this->db->join('add

php - Eloquent Query 用于获取用户没有完成交易的所有用户失败交易

我很难构建一个Eloquent查询来提供一个问题案例交易的仪表板。问题定义为用户未完成交易的所有失败交易。我有两个表,users和transactions。一个用户可以有很多交易,一个交易的状态可以是已完成或失败。我需要一个Eloquent查询来从所有至少有一个失败交易并且没有任何完成交易的用户那里获取失败交易列表。我目前通过查询用户而不是交易从另一个方向来解决这个问题$failed_transactions=User::has('transactions')->whereDoesntHave('transactions',function($query){$query->where(

mysql - Doctrine 选择 innerJoined 实体或没有关联的实体

我有以下与用户和地址相关联的模型:User-id-email-passwordAddress-id-street-zip_code-city-user_idOneuserhas[0:n]Address:users(id,email,password)======================================|1|"someone1@example.org"|"..."||2|"someone2@example.org"|"..."||3|"someone3@example.org"|"..."||4|"someone4@example.org"|"..."||5|"s

php - Laravel 查询错误 - 调用未定义的方法 Illuminate\Database\Query\Builder::query()

我想从CSV文件中插入一些数据,但是当我上传它们时有错误报告。在laravel或PHP中最好的方法是什么。enterimagedescriptionherepublicfunctionuploadFile(Request$request){$conexao=\DB::table('tb_pwbi_analytics_acesso');$arquivo=$_FILES['file']['tmp_name'];$nome=$_FILES['file']['name'];$ext=explode(".",$nome);$extensao=end($ext);if($extensao!='cs