Am trying to use the FOSOAuthServerBundle but am having a crash problem, the crash message is :
PHP Fatal error: Declaration of MP\OAuthBundle\Entity\AccessToken::setUser() must be compatible with that of FOS\OAuthServerBundle\Model\TokenInterface::setUser() in /home/bitnami..../OAuthBundle/Entity/AccessToken.php on line 13
Run Code Online (Sandbox Code Playgroud)
AccessToken.class:
<?php
namespace MP\OAuthBundle\Entity;
use FOS\OAuthServerBundle\Entity\AccessToken as BaseAccessToken;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="oauth_access_tokens")
*/
class AccessToken extends BaseAccessToken
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="Client")
* @ORM\JoinColumn(nullable=false)
*/
protected $client;
/**
* @ORM\ManyToOne(targetEntity="\MP\UserBundle\Entity\User")
*/ …Run Code Online (Sandbox Code Playgroud) 我在SQL中有下面的查询
... where group_id IN (select group_id from alert where monitor_id = 4);
Run Code Online (Sandbox Code Playgroud)
我想在Doctrine中编写它,但我不知道如何将IN select添加到WHEREIN()子句中!任何的想法 ?
这就是我做的
$q = $this->createQuery('u')
->select('u.email_address')
->distinct(true)
// ->from('sf_guard_user u')
->innerJoin('u.sfGuardUserGroup ug')
->where('ug.group_id IN(select group_id from alert where monitor_id=?',$monitor);
$q->execute();
Run Code Online (Sandbox Code Playgroud)
在sfGuardUserTable.class中:
public function getMailsByMonitor($monitor) {
$q = Doctrine_Query::create()->from("alert a")->where("a.monitor_id", $monitor);
$groups_raw = $q->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
$groups = array();
print_r($groups_raw);
foreach ($groups_raw as $gr) {
$groups[] = $gr->id; //line 33
}
$q2 = $this->createQuery('u')
->select('u.email_address')
->distinct(true)
->innerJoin('u.sfGuardUserGroup ug')
->whereIn("ug.group_id", $groups);
return $q2->execute();
}
Run Code Online (Sandbox Code Playgroud) 在我的情况下,我有一个带登录名和密码的小表单,一旦提交,登录/通行证用于打开一个imap conn来检索用户的电子邮件,一旦在同一个动作中检索到的电子邮件数组,我想重定向到另一个动作是使用该阵列的其他treatements!
怎么可能?我的意思是重定向到另一个动作并将整个数组作为post参数发送?
我想知道在Android上使用ORM的真正必要性.什么是" 加号 "认为,使用ORM在Android conding时,可我们得到的?是不是使用本机android方法sufficiant(使用SqlLIte和编写自己的类和自己的SQL查询(我认为需要大量的时间和代码行))?
使用ORM尤其是在移动设备上有什么好处和缺点?