草庐IT

doctrine-query

全部标签

php - PHP PDO::query 实际上是怎么做的?

关于PDO::query做什么的一些混淆。完全理解它与准备和执行之间的区别,但是不清楚查询是否运行提取。根据PHP.net:PDO::query—ExecutesanSQLstatement,returningaresultsetasaPDOStatementobject证明:$s=$pdo->query('SELECT*FROMuser');var_dump($s);哪些输出:object(PDOStatement)#2(1){["queryString"]=>string(18)"SELECT*FROMuser"}因此,它显然为我们提供了一个准备好运行fetch或fetchAll的

javascript - Yii2 和 Ajax : The response is not the SQL query results

我想使用jQuery执行AJAX查询,但响应不是我想要的。客户端:$.ajax({url:"/family?idperson=1234",dataType:'json',success:function(res){console.log(JSON.stringify(res,null,4));},error:function(err){}});服务器端:publicfunctionactionFamily($idperson){$searchModelFamily=newFamilySearch();$dataProvider=$searchModelFamily->searchByI

php - 当我对 Doctrine 实体进行 json_encode 时,如何使用 getter 方法作为属性?

比如在类里面/***@Doctrine\ORM\Mapping\Entity*/classExample{/***@varintTheid**@Doctrine\ORM\Mapping\Id*@Doctrine\ORM\Mapping\GeneratedValue*@Doctrine\ORM\Mapping\Column(type="integer")*/public$id;/***@varstring**@Doctrine\ORM\Mapping\Column(type="string")*/public$name;publicfunctiongetRandomNumber(){re

php - 插入与 Doctrine 相关的记录后获取 ID

使用PHPDoctrine项目插入新记录后,我无法获取ID。在没有父表(没有外键)的表中插入新记录不会发生问题。但是当在这里插入相关记录时出现了问题,我只得到了父ID,这对我来说是无用的。PHP代码示例:$city=newCity();$city->name="Baghdad";$city->country_id=6;$city->save();print_r($city->identifier());exit;输出是:Array([id]=>[country_id]=>6)为什么ID为空!,行插入成功!。我需要它来做更多基于city.id的插入,就像以这个城市为父级的其他区域一样。注

php - 使用过多内存问题的 Doctrine 事务

我在运行我的脚本之一时不断收到此错误;PHPFatalerror:Allowedmemorysizeof1073741824bytesexhausted(triedtoallocate71bytes)in...lib/symfony-1.4.11/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/Statement.phponline246,...以下是脚本的精简版触发错误;publicfunctionexecuteImportFile(sfWebRequest$request){ini_set('

php - Symfony Doctrine 查询错误

我有以下代码:$getmoney=Doctrine::getTable('Countries')->find(1);$insertmoney=newAccounts();$insertmoney->userid=$userid;$insertmoney[$getmoney->getCurrency()]=$getmoney->getBaby();$insertmoney->save();Doctrine生成的查询是:INSERTINTOaccounts(1,userid,2)VALUES('0','31','15')但它似乎有一个SQL错误:1064你的SQL语法有错误;查看与您的My

php - Doctrine 2.1 - 获取实体限制

我有两个类(class):游戏/**@Entity@Table(name="games")*/classGame{/**@Id@GeneratedValue@Column(type="integer")*/protected$id;/**@Column(type="string",length=100)*/protected$title;/**@ManyToMany(targetEntity="News",mappedBy="games")*/protected$news;publicfunction__construct(){$this->news=new\Doctrine\Comm

php - Doctrine2 - 使用外键列作为普通字段

有没有办法在教义上有这样的东西:classEntity{/***@Column(name="related_entity_id")*/private$relatedEntityId;/***@ManyToOne(targetEntity="RelatedEntitiy")*@JoinColumn(name="related_entity_id",referencedColumnName="id")*/private$relatedEntity;}我想做的是这样的:调用Entity::setRelatedEntityId($someId),并持久化实体,并让实体通过调用Entity::g

php - Doctrine 的 Symfony Bundle repo 发生了什么?

我刚刚花了最后2个小时想知道为什么当我对我的项目进行bin/vendors更新时一切都崩溃了。我收到以下错误fatal:github.com/symfony/DoctrineMigrationsBundle.git/info/refsnotfound:didyourungitupdate-server-infoontheserver?fatal:github.com/symfony/DoctrineMongoDBBundle.git/info/refsnotfound:didyourungitupdate-server-infoontheserver?fatal:github.com/

php - wp_reset_query() wordpress - 无法重置最后一个查询

我试图在一个页面上运行两个查询。第一个显示自定义用户搜索的结果第二个只是应该显示最近的记录,其中有一些硬编码到查询中的自定义参数。我遇到的问题是,当运行自定义搜索时,两个查询都会受到影响,并且两个地方的结果都会更新。我试过放置这些wp_reset_postdata();wp_reset_query();到处都是,但都没有。有没有人有什么想法?这是我的第一个查询$args=array('post_type'=>'vacancy','post_status'=>'publish'));add_filter('posts_where','posts_where_title',10,2);fu