- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用以下查询来获取记录
$qb = $EM->createQueryBuilder();
$PostDataSets = $qb->select('user','follower')->from('WebService\Entity\User', 'user')
->innerJoin('WebService\Entity\Follower','follower', $qb->expr()->eq('user.id', 'follower.following_id'))
->where($qb->expr()->like('user.username', $qb->expr()->literal('%' . 'admin' . '%')))
->getQuery()
->getResult();
现在当我循环遍历结果集时出现以下错误
foreach ($PostDataSets as $i => $PostDataSet) {
$postDataArray[$i]['id'] = $PostDataSet->getId();
$postDataArray[$i]['user_id'] = $PostDataSet->getId();
$postDataArray[$i]['username'] = $PostDataSet->getUserName();
$postDataArray[$i]['full_name'] = $PostDataSet->getFullName();
$postDataArray[$i]['photo'] = $PostDataSet->getPhoto();
$postDataArray[$i]['created_at'] = $PostDataSet->getCreatedAt();
$postDataArray[$i]['updated_at'] = $PostDataSet->getUpdatedAt();
}
这是我得到的错误
Fatal error: Call to undefined method WebService\Entity\Follower::getUserName() in R:\xampp\htdocs\myapp\module\WebService\src\WebService\Controller\PostController.php on line 142
但是如果我将查询更改为以下,我不会收到任何错误。
$qb = $EM->createQueryBuilder();
$PostDataSets = $qb->select('user')->from('WebService\Entity\User', 'user')
->innerJoin('WebService\Entity\Follower','follower', $qb->expr()->eq('user.id', 'follower.following_id'))
->where($qb->expr()->like('user.username', $qb->expr()->literal('%' . 'admin' . '%')))
->getQuery()
->getResult();
谁能解释错误的原因?
编辑这是转储
object(stdClass)#365 (34) { ["__CLASS__"]=> string(22) "WebService\Entity\User" ["id"]=> int(1) ["Country"]=> NULL ["Posts"]=> array(17) { [0]=> string(22) "WebService\Entity\Post" [1]=> string(22) "WebService\Entity\Post" [2]=> string(22) "WebService\Entity\Post" [3]=> string(22) "WebService\Entity\Post" [4]=> string(22) "WebService\Entity\Post" [5]=> string(22) "WebService\Entity\Post" [6]=> string(22) "WebService\Entity\Post" [7]=> string(22) "WebService\Entity\Post" [8]=> string(22) "WebService\Entity\Post" [9]=> string(22) "WebService\Entity\Post" [10]=> string(22) "WebService\Entity\Post" [11]=> string(22) "WebService\Entity\Post" [12]=> string(22) "WebService\Entity\Post" [13]=> string(22) "WebService\Entity\Post" [14]=> string(22) "WebService\Entity\Post" [15]=> string(22) "WebService\Entity\Post" [16]=> string(22) "WebService\Entity\Post" } ["FollowingUsers"]=> array(4) { [0]=> string(26) "WebService\Entity\Follower" [1]=> string(26) "WebService\Entity\Follower" [2]=> string(26) "WebService\Entity\Follower" [3]=> string(26) "WebService\Entity\Follower" } ["FollowerUsers"]=> array(4) { [0]=> string(26) "WebService\Entity\Follower" [1]=> string(26) "WebService\Entity\Follower" [2]=> string(26) "WebService\Entity\Follower" [3]=> string(26) "WebService\Entity\Follower" } ["PostLikes"]=> array(0) { } ["CommentLikes"]=> array(0) { } ["Comments"]=> array(1) { [0]=> string(25) "WebService\Entity\Comment" } ["username"]=> string(5) "admin" ["password"]=> string(60) "$2y$10$WxVcjXy3ond8dyYKz3VeQuv155pLWcNYoSti5hSB31oEHhWjWI3DC" ["email"]=> string(21) "m.rashid.se@gmail.com" ["fname"]=> NULL ["lname"]=> NULL ["full_name"]=> string(15) "Muhammad Rashid" ["dname"]=> NULL ["dob"]=> object(stdClass)#850 (3) { ["__CLASS__"]=> string(8) "DateTime" ["date"]=> string(25) "1983-06-08T00:00:00+02:00" ["timezone"]=> string(13) "Europe/Berlin" } ["gender"]=> NULL ["relationship"]=> NULL ["interested_in"]=> NULL ["photo"]=> NULL ["cover_photo"]=> NULL ["state"]=> NULL ["city"]=> NULL ["address"]=> NULL ["current_location"]=> NULL ["cell"]=> NULL ["phone"]=> NULL ["about_me"]=> NULL ["remember_me"]=> NULL ["salt"]=> string(24) "WxVcjXy3ond8dyYKz3VeQw==" ["created_at"]=> object(stdClass)#851 (3) { ["__CLASS__"]=> string(8) "DateTime" ["date"]=> string(25) "2014-12-20T13:31:33+01:00" ["timezone"]=> string(13) "Europe/Berlin" } ["updated_at"]=> NULL ["deleted_at"]=> NULL } object(stdClass)#365 (7) { ["__CLASS__"]=> string(26) "WebService\Entity\Follower" ["id"]=> int(1) ["FollowingUser"]=> object(stdClass)#660 (34) { ["__CLASS__"]=> string(22) "WebService\Entity\User" ["id"]=> int(1) ["Country"]=> NULL ["Posts"]=> string(9) "Array(17)" ["FollowingUsers"]=> string(8) "Array(4)" ["FollowerUsers"]=> string(8) "Array(4)" ["PostLikes"]=> string(8) "Array(0)" ["CommentLikes"]=> string(8) "Array(0)" ["Comments"]=> string(8) "Array(1)" ["username"]=> string(5) "admin" ["password"]=> string(60) "$2y$10$WxVcjXy3ond8dyYKz3VeQuv155pLWcNYoSti5hSB31oEHhWjWI3DC" ["email"]=> string(21) "m.rashid.se@gmail.com" ["fname"]=> NULL ["lname"]=> NULL ["full_name"]=> string(15) "Muhammad Rashid" ["dname"]=> NULL ["dob"]=> string(8) "DateTime" ["gender"]=> NULL ["relationship"]=> NULL ["interested_in"]=> NULL ["photo"]=> NULL ["cover_photo"]=> NULL ["state"]=> NULL ["city"]=> NULL ["address"]=> NULL ["current_location"]=> NULL ["cell"]=> NULL ["phone"]=> NULL ["about_me"]=> NULL ["remember_me"]=> NULL ["salt"]=> string(24) "WxVcjXy3ond8dyYKz3VeQw==" ["created_at"]=> string(8) "DateTime" ["updated_at"]=> NULL ["deleted_at"]=> NULL } ["FollowerUser"]=> object(stdClass)#864 (34) { ["__CLASS__"]=> string(22) "WebService\Entity\User" ["id"]=> int(1) ["Country"]=> NULL ["Posts"]=> string(9) "Array(17)" ["FollowingUsers"]=> string(8) "Array(4)" ["FollowerUsers"]=> string(8) "Array(4)" ["PostLikes"]=> string(8) "Array(0)" ["CommentLikes"]=> string(8) "Array(0)" ["Comments"]=> string(8) "Array(1)" ["username"]=> string(5) "admin" ["password"]=> string(60) "$2y$10$WxVcjXy3ond8dyYKz3VeQuv155pLWcNYoSti5hSB31oEHhWjWI3DC" ["email"]=> string(21) "m.rashid.se@gmail.com" ["fname"]=> NULL ["lname"]=> NULL ["full_name"]=> string(15) "Muhammad Rashid" ["dname"]=> NULL ["dob"]=> string(8) "DateTime" ["gender"]=> NULL ["relationship"]=> NULL ["interested_in"]=> NULL ["photo"]=> NULL ["cover_photo"]=> NULL ["state"]=> NULL ["city"]=> NULL ["address"]=> NULL ["current_location"]=> NULL ["cell"]=> NULL ["phone"]=> NULL ["about_me"]=> NULL ["remember_me"]=> NULL ["salt"]=> string(24) "WxVcjXy3ond8dyYKz3VeQw==" ["created_at"]=> string(8) "DateTime" ["updated_at"]=> NULL ["deleted_at"]=> NULL } ["are_we_following"]=> int(1) ["created_at"]=> NULL ["updated_at"]=> NULL }
Fatal error: Call to undefined method WebService\Entity\Follower::getUserName() in R:\xampp\htdocs\kanvas-php\module\WebService\src\WebService\Controller\PostController.php on line 144
<?php
namespace WebService\Entity;
use Doctrine\ORM\Mapping as ORM;
use WebService\Entity\Post;
use WebService\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
use DoctrineModule\Stdlib\Hydrator\DoctrineObject as DoctrineHydrator;
/**
* An Follower entity.
*
* @ORM\Entity
* @ORM\Table(name="followers")
*
* @property int $id
* @property User $FollowingUser
* @property User $FollowerUser
* @property smallint $are_we_following
* @property datetime $created_at
* @property datetime $updated_at
*
*/
class Follower extends EntityHydrator {
/**
* @ORM\Id
* @ORM\Column(type="integer",length=11);
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* This is the user who will be followed
* @ORM\ManyToOne(targetEntity="User", inversedBy="FollowingUsers")
* @ORM\JoinColumn(name="following_id", referencedColumnName="id", nullable=false)
*
*/
protected $FollowingUser;
/**
* This is the user who is going to follow
* @ORM\ManyToOne(targetEntity="User", inversedBy="FollowerUsers")
* @ORM\JoinColumn(name="follower_id", referencedColumnName="id", nullable=false)
*
*/
protected $FollowerUser;
/**
* This column shows that are we also following the user
* @ORM\Column(type="smallint", length=1, nullable=true, options={"default"=0})
*
*/
protected $are_we_following;
/**
* @ORM\Column(type="datetime", nullable=true)
*
*/
protected $created_at;
/**
* @ORM\Column(type="datetime", nullable=true)
*
*/
protected $updated_at;
public function __construct(array $data = null) {
parent::__construct($data, $this, true);
}
public function getId() {
return $this->id;
}
public function getFollowingUser() {
return $this->FollowingUser;
}
public function getFollowerUser() {
return $this->FollowerUser;
}
public function getAreWeFollowing() {
return $this->are_we_following;
}
public function getCreatedAt() {
return $this->created_at;
}
public function getUpdatedAt() {
return $this->updated_at;
}
public function setId($id) {
$this->id = $id;
}
public function setFollowingUser($FollowingUser) {
$this->FollowingUser = $FollowingUser;
}
public function setFollowerUser($FollowerUser) {
$this->FollowerUser = $FollowerUser;
}
public function setAreWeFollowing($are_we_following) {
$this->are_we_following = $are_we_following;
}
public function setCreatedAt($created_at) {
$this->created_at = $created_at;
}
public function setUpdatedAt($updated_at) {
$this->updated_at = $updated_at;
}
}
用户实体
<?php
namespace WebService\Entity;
use Doctrine\ORM\Mapping as ORM;
use \WebService\Entity\Country;
use Doctrine\Common\Collections\ArrayCollection;
/**
* An User entity.
*
* @ORM\Entity
* @ORM\Table(name="users", uniqueConstraints={@ORM\UniqueConstraint(name="username", columns={"username"}), @ORM\UniqueConstraint(name="email", columns={"email"})})
*
* @property int $id
* @property Country $Country
* @property ArrayCollection $Posts
* @property ArrayCollection $Comments
* @property ArrayCollection $CommentLikes
* @property ArrayCollection $FollowingUsers
* @property ArrayCollection $FollowerUsers
* @property string $username
* @property string $password
* @property string $email
* @property string $fname
* @property string $lname
* @property string $dname
* @property string $dob
* @property string $gender
* @property string $relationship
* @property string $interested_in
* @property string $photo
* @property string $cover_photo
* @property string $country_id
* @property string $state
* @property string $city
* @property string $address
* @property string $current_location
* @property string $cell
* @property string $phone
* @property string $about_me
* @property string $remember_me
* @property string $salt
* @property datetime $created_at
* @property datetime $updated_at
* @property datetime $deleted_at
*
*/
class User extends EntityHydrator{
const SALT = 'ACK3HtAz[|U8]Of9@?Ppj:!';
const SALT_LENGTH = 16;
/**
* @ORM\Id
* @ORM\Column(type="integer",length=11);
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="Country", inversedBy="Users")
* @ORM\JoinColumn(name="country_id", referencedColumnName="id", nullable=true)
*
*/
protected $Country;
/**
* @ORM\OneToMany(targetEntity="Post", mappedBy="User", orphanRemoval=true, cascade={"persist"})
*
*/
protected $Posts;
/**
* @ORM\OneToMany(targetEntity="Follower", mappedBy="FollowingUser", orphanRemoval=true, cascade={"persist"})
*
*/
protected $FollowingUsers;
/**
* @ORM\OneToMany(targetEntity="Follower", mappedBy="FollowerUser", orphanRemoval=true, cascade={"persist"})
*
*/
protected $FollowerUsers;
/**
* @ORM\OneToMany(targetEntity="PostLike", mappedBy="User", orphanRemoval=true, cascade={"persist"})
*
*/
protected $PostLikes;
/**
* @ORM\OneToMany(targetEntity="CommentLike", mappedBy="User", orphanRemoval=true, cascade={"persist"})
*
*/
protected $CommentLikes;
/**
* @ORM\OneToMany(targetEntity="Comment", mappedBy="User", orphanRemoval=true, cascade={"persist"})
*
*/
protected $Comments;
/**
* @ORM\Column(type="string", length=50, nullable=false)
*
*/
protected $username;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*
*/
protected $password;
/**
* @ORM\Column(type="string", length=60, nullable=false)
*
*/
protected $email;
/**
* @ORM\Column(type="string", length=60, nullable=true)
*
*/
protected $fname;
/**
* @ORM\Column(type="string", length=60, nullable=true)
*
*/
protected $lname;
/**
* @ORM\Column(type="string", length=120, nullable=false)
*
*/
protected $full_name;
/**
* @ORM\Column(type="string", length=60, nullable=true)
*
*/
protected $dname;
/**
* @ORM\Column(type="datetime", nullable=true)
*
*/
protected $dob;
/**
* @ORM\Column(type="string", columnDefinition="ENUM('Male','Female', 'Do not wish to disclose')", nullable=true)
*
*/
protected $gender;
/**
* @ORM\Column(type="string", columnDefinition="ENUM('Married','Single', 'Complicated','Divorced','Seperated','Engaged')", nullable=true)
*
*/
protected $relationship;
/**
* @ORM\Column(type="string", columnDefinition="ENUM('Male','Female', 'Both')", nullable=true)
*
*/
protected $interested_in;
/**
* @ORM\Column(type="string",length=1024, nullable=true)
*
*/
protected $photo;
/**
* @ORM\Column(type="string",length=1024, nullable=true)
*
*/
protected $cover_photo;
/**
* @ORM\Column(type="string",length=60, nullable=true)
*
*/
protected $state;
/**
* @ORM\Column(type="string",length=60, nullable=true)
*
*/
protected $city;
/**
* @ORM\Column(type="string",length=255, nullable=true)
*
*/
protected $address;
/**
* @ORM\Column(type="string",length=255, nullable=true)
*
*/
protected $current_location;
/**
* @ORM\Column(type="string",length=20, nullable=true)
*
*/
protected $cell;
/**
* @ORM\Column(type="string",length=20, nullable=true)
*
*/
protected $phone;
/**
* @ORM\Column(type="string",length=255, nullable=true)
*
*/
protected $about_me;
/**
* @ORM\Column(type="smallint", length=1, nullable=true, options={"default"=0})
*
*/
protected $remember_me;
/**
* @ORM\Column(type="string", length=100, nullable=false)
*
*/
protected $salt;
/**
* @ORM\Column(type="datetime", nullable=true)
*
*/
protected $created_at;
/**
* @ORM\Column(type="datetime", nullable=true)
*
*/
protected $updated_at;
/**
* @ORM\Column(type="datetime", nullable=true)
*
*/
protected $deleted_at;
public function __construct(array $data = null)
{
parent::__construct($data, $this, true);
}
public function getId() {
return $this->id;
}
public function setId($id) {
$this->id = $id;
return $this;
}
public function getUsername() {
return $this->username;
}
public function setUsername($username) {
$this->username = $username;
return $this;
}
public function getPassword() {
return $this->password;
}
public function setPassword($password) {
$Bcrypt = new \Zend\Crypt\Password\Bcrypt();
if (empty($this->salt)) {
$this->setSalt();
}
$Bcrypt->setSalt(base64_decode($this->salt));
$hashedPassword = $Bcrypt->create($password);
$this->password = $hashedPassword;
// $this->password = $password;
}
public function getSalt() {
return $this->salt;
}
public function setSalt($salt = null) {
if (empty($salt)) {
$salt = \Zend\Math\Rand::getBytes(self::SALT_LENGTH, $strong = false);
$encrytSalt = base64_encode($salt);
} else {
$encrytSalt = $salt;
}
$this->salt = $encrytSalt;
return $this;
}
/**
* @return mixed
*/
public function getComments()
{
return $this->Comments;
}
/**
* @param mixed $Comments
*/
public function setComments($Comments)
{
$this->Comments = $Comments;
}
/**
* @return mixed
*/
public function getCountry()
{
return $this->Country;
}
/**
* @param mixed $Country
*/
public function setCountry($Country)
{
$this->Country = $Country;
}
/**
* @return mixed
*/
public function getPosts()
{
return $this->Posts;
}
/**
* @param mixed $Posts
*/
public function setPosts($Posts)
{
$this->Posts = $Posts;
}
/**
* @return mixed
*/
public function getAboutMe()
{
return $this->about_me;
}
/**
* @param mixed $about_me
*/
public function setAboutMe($about_me)
{
$this->about_me = $about_me;
}
/**
* @return mixed
*/
public function getAddress()
{
return $this->address;
}
/**
* @param mixed $address
*/
public function setAddress($address)
{
$this->address = $address;
}
/**
* @return mixed
*/
public function getCell()
{
return $this->cell;
}
/**
* @param mixed $cell
*/
public function setCell($cell)
{
$this->cell = $cell;
}
/**
* @return mixed
*/
public function getCity()
{
return $this->city;
}
/**
* @param mixed $city
*/
public function setCity($city)
{
$this->city = $city;
}
/**
* @return mixed
*/
public function getCountryId()
{
return $this->country_id;
}
/**
* @param mixed $country_id
*/
public function setCountryId($country_id)
{
$this->country_id = $country_id;
}
/**
* @return mixed
*/
public function getCoverPhoto()
{
return $this->cover_photo;
}
/**
* @param mixed $cover_photo
*/
public function setCoverPhoto($cover_photo)
{
$this->cover_photo = $cover_photo;
}
/**
* @return mixed
*/
public function getCreatedAt()
{
return $this->created_at;
}
/**
* @param mixed $created_at
*/
public function setCreatedAt($created_at)
{
$this->created_at = $created_at;
}
/**
* @return mixed
*/
public function getCurrentLocation()
{
return $this->current_location;
}
/**
* @param mixed $current_location
*/
public function setCurrentLocation($current_location)
{
$this->current_location = $current_location;
}
/**
* @return mixed
*/
public function getDeletedAt()
{
return $this->deleted_at;
}
/**
* @param mixed $deleted_at
*/
public function setDeletedAt($deleted_at)
{
$this->deleted_at = $deleted_at;
}
/**
* @return mixed
*/
public function getDname()
{
return $this->dname;
}
/**
* @param mixed $dname
*/
public function setDname($dname)
{
$this->dname = $dname;
}
/**
* @return mixed
*/
public function getDob()
{
return $this->dob;
}
/**
* @param mixed $dob
*/
public function setDob($dob)
{
$this->dob = $dob;
}
/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}
/**
* @param mixed $email
*/
public function setEmail($email)
{
$this->email = $email;
}
/**
* @return mixed
*/
public function getFname()
{
return $this->fname;
}
/**
* @param mixed $fname
*/
public function setFname($fname)
{
$this->fname = $fname;
}
/**
* @return mixed
*/
public function getFullName()
{
return $this->full_name;
}
/**
* @param mixed $full_name
*/
public function setFullName($full_name)
{
$this->full_name = $full_name;
}
/**
* @return mixed
*/
public function getGender()
{
return $this->gender;
}
/**
* @param mixed $gender
*/
public function setGender($gender)
{
$this->gender = $gender;
}
/**
* @return mixed
*/
public function getInterestedIn()
{
return $this->interested_in;
}
/**
* @param mixed $interested_in
*/
public function setInterestedIn($interested_in)
{
$this->interested_in = $interested_in;
}
/**
* @return mixed
*/
public function getLname()
{
return $this->lname;
}
/**
* @param mixed $lname
*/
public function setLname($lname)
{
$this->lname = $lname;
}
/**
* @return mixed
*/
public function getPhone()
{
return $this->phone;
}
/**
* @param mixed $phone
*/
public function setPhone($phone)
{
$this->phone = $phone;
}
/**
* @return mixed
*/
public function getPhoto()
{
return $this->photo;
}
/**
* @param mixed $photo
*/
public function setPhoto($photo)
{
$this->photo = $photo;
}
/**
* @return mixed
*/
public function getRelationship()
{
return $this->relationship;
}
/**
* @param mixed $relationship
*/
public function setRelationship($relationship)
{
$this->relationship = $relationship;
}
/**
* @return mixed
*/
public function getRememberMe()
{
return $this->remember_me;
}
/**
* @param mixed $remember_me
*/
public function setRememberMe($remember_me)
{
$this->remember_me = $remember_me;
}
/**
* @return mixed
*/
public function getState()
{
return $this->state;
}
/**
* @param mixed $state
*/
public function setState($state)
{
$this->state = $state;
}
/**
* @return mixed
*/
public function getUpdatedAt()
{
return $this->updated_at;
}
/**
* @param mixed $updated_at
*/
public function setUpdatedAt($updated_at)
{
$this->updated_at = $updated_at;
}
//============================================================================
public static function verifyHashedPassword(\WebService\Entity\User $User, $passwordGiven) {
$Bcrypt = new \Zend\Crypt\Password\Bcrypt();
$Bcrypt->setSalt(base64_decode($User->getSalt()));
return $Bcrypt->verify($passwordGiven, $User->getPassword());
}
public static function makeHashedPassword(\WebService\Entity\User $User, $passwordGiven)
{
//@todo makeHashedPassword Definition
return '';
}
}
最佳答案
我不是 100% 确定这个答案,但让我们看看:
1.) 问题
如您所见here :
A SELECT query can contain joins. There are 2 types of JOINs: “Regular” Joins and “Fetch” Joins.
Regular Joins: Used to limit the results and/or compute aggregate values.
Fetch Joins: In addition to the uses of regular joins: Used to fetch related entities and include them in the hydrated result of a query.
There is no special DQL keyword that distinguishes a regular join from a fetch join. A join (be it an inner or outer join) becomes a “fetch join” as soon as fields of the joined entity appear in the SELECT part of the DQL query outside of an aggregate function. Otherwise its a “regular join”.
所以基本上您的第一个查询使用提取连接,您的第二个查询(有效)使用常规连接。
现在,为什么常规连接有效而提取连接无效?常规连接获取用户实体,您可以按预期调用 getUserName 方法。关注者关系或多或少被忽略了,因为在常规连接中它只会用于过滤结果。
获取连接变体(这里我们到了我不太确定的部分)必须获取用户和关注者实体,因为它们都传递给了 select
方法。但是关注者实体是关系的拥有方(关系存储在关注者实体中),因此查询返回关注者实体而不是用户实体,您必须通过调用一些 getUser
来获取用户实体。追随者实体上的方法。这也可以解释为什么 getId
方法(可能存在于两个实体上)即使在 getUserName
之前调用也不会导致错误方法。
2.) 可能的解决方案:
您的查询可能应该如下所示:
$EM->createQueryBuilder();
$followers = $qb->select('follower', 'user')
->from('WebService\Entity\Follower', 'follower')
->join('follower.FollowingUser', 'user')
->where($qb->expr()->like('user.username', $qb->expr()->literal('%' . 'admin' . '%')))
->getQuery()
->getResult();
foreach ($followers as $follower) {
$user = $follower->getFollowingUser();
$postDataArray[$i]['id'] = $follower->getId();
$postDataArray[$i]['user_id'] = $user->getId();
$postDataArray[$i]['username'] = $user->getUserName();
$postDataArray[$i]['full_name'] = $user->getFullName();
$postDataArray[$i]['photo'] = $user->getPhoto();
$postDataArray[$i]['created_at'] = $follower->getCreatedAt();
$postDataArray[$i]['updated_at'] = $follower->getUpdatedAt();
}
这应该会为您提供所有关注用户匹配 %admin%
的关注者;虽然没有测试。
关于php - 使用连接时未从第二个表中获取教义值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35127385/
我知道这个问题可能已经被问过,但我检查了所有这些,我认为我的情况有所不同(请友善)。所以我有两个数据集,第一个是测试数据集,第二个是我保存在数据框中的预测(预测值,这就是没有数据列的原因)。我想合并两
在 .loc 方法的帮助下,我根据同一数据框中另一列中的值来识别 Panda 数据框中某一列中的值。 下面给出了代码片段供您引用: var1 = output_df['Player'].loc[out
当我在 Windows 中使用 WinSCP 通过 Ubuntu 连接到 VMware 时,它提示: The server rejected SFTP connection, but it lis
我正在开发一个使用 xml web 服务的 android 应用程序。在 wi-fi 网络中连接时工作正常,但在 3G 网络中连接时失败(未找到 http 404)。 这不仅仅发生在设备中。为了进行测
我有一个XIB包含我的控件的文件,加载到 Interface Builder(Snow Leopard 上的 Xcode 4.0.2)中。 文件的所有者被设置为 someClassController
我在本地计算机上管理 MySQL 数据库,并通过运行以下程序通过 C 连接到它: #include #include #include int main(int argc, char** arg
我不知道为什么每次有人访问我网站上的页面时,都会打开一个与数据库的新连接。最终我到达了大约 300 并收到错误并且页面不再加载。我认为它应该工作的方式是,我将 maxIdle 设置为 30,这意味着
希望清理 NMEA GPS 中的 .txt 文件。我当前的代码如下。 deletes = ['$GPGGA', '$GPGSA', '$GPGSV', '$PSRF156', ] searchquer
我有一个 URL、一个用户名和一个密码。我想在 C# .Net WinForms 中建立 VPN 连接。 你能告诉我从哪里开始吗?任何第三方 API? 代码示例将受到高度赞赏... 最佳答案 您可以像
有没有更好的方法将字符串 vector 转换为字符 vector ,字符串之间的终止符为零。 因此,如果我有一个包含以下字符串的 vector "test","my","string",那么我想接收一
我正在编写一个库,它不断检查 android 设备的连接,并在设备连接、断开连接或互联网连接变慢时给出回调。 https://github.com/muddassir235/connection_ch
我的操作系统:Centos 7 + CLOUDLINUX 7.7当我尝试从服务器登录Mysql时 [root@server3 ~]# Mysql -u root -h localhost -P 330
我收到错误:Puma 发现此错误:无法打开到本地主机的 TCP 连接:9200(连接被拒绝 - 连接(2)用于“本地主机”端口 9200)(Faraday::ConnectionFailed)在我的
请给我一些解决以下错误的方法。 这是一个聊天应用....代码和错误如下:: conversations_controller.rb def create if Conversation.bet
我想将两个单元格中的数据连接到一个单元格中。我还想只组合那些具有相同 ID 的单元格。 任务 ID 名称 4355.2 参与者 4355.2 领袖 4462.1 在线 4462.1 快速 4597.1
我经常需要连接 TSQL 中的字段... 使用“+”运算符时 TSQL 强制您处理的两个问题是 Data Type Precedence和 NULL 值。 使用数据类型优先级,问题是转换错误。 1)
有没有在 iPad 或 iPhone 应用程序中使用 Facebook 连接。 这个想法是登录这个应用程序,然后能够看到我的哪些 facebook 用户也在使用该应用程序及其功能。 最佳答案 是的。
我在连接或打印字符串时遇到了一个奇怪的问题。我有一个 char * ,可以将其设置为字符串文字的几个值之一。 char *myStrLiteral = NULL; ... if(blah) myS
对于以下数据 - let $x := "Yahooooo !!!! Select one number - " let $y := 1 2 3 4 5 6 7 我想得到
我正在看 UDEMY for perl 的培训视频,但是视频不清晰,看起来有错误。 培训展示了如何使用以下示例连接 2 个字符串: #!usr/bin/perl print $str = "Hi";
我是一名优秀的程序员,十分优秀!