Hey helpers, My db model:
<?php
namespace Ocapp\Models;
use \Phalcon\Mvc\Model;
class UserHistories extends Model
{
/**
*
* @var integer
* @Primary
* @Identity
* @Column(type="integer", length=11, nullable=false)
*/
public $id;
/**
*
* @var integer
* @Column(type="integer", length=11, nullable=false)
*/
public $vendorId;
/**
*
* @var integer
* @Column(type="integer", length=11, nullable=false)
*/
public $userId;
/**
*
* @var string
* @Column(type="string", nullable=false)
*/
public $use_time;
/**
* Initialize method for model.
*/
public function initialize()
{
$this->belongsTo('userId', __NAMESPACE__ . '\Users', 'id', [
'alias' => 'user'
]);
$this->belongsTo('vendorId', __NAMESPACE__ . '\Users', 'id', [
'alias' => 'vendor'
]);
}
}
when i use
$userHistories = UserHistories::findFirst('userId=30');
it returns the resultset
but it returns null with find() and findByUserid().