Welcome Guest, Not a member yet? Register   Sign In
doctrine one to many call
#1

[eluser]Mutsop[/eluser]
Hi,

I have a few models wich have relations between each other.
user:
Code:
$this->hasMany('Api as Apis', array(
                'local' => 'id',
                'foreign' => 'api_user_id'
            )
        );

api:
Code:
$this->hasOne('User', array(
                'local' => 'api_user_id',
                'foreign' => 'id'
            )
        );
        $this->hasMany('Character as Characters', array(
                'local' => 'api_id',
                'foreign' => 'char_api_id'
            )
        );

char:
Code:
$this->hasOne('Api', array(
                'local' => 'char_api_id',
                'foreign' => 'api_id'
            )
        );

Now in my call model I would like to get a variable from the url (?name=...)

Firstly: how do call upon the name into the model?
Secondly: how do I get the APIkey (from the api model $this->hasColumn('api_key', 'string', 255, array('unique' => 'true'))Wink from the "findOneByUsername"?
#2

[eluser]Mutsop[/eluser]
If I need to clarify more, please do tell me Smile




Theme © iAndrew 2016 - Forum software by © MyBB