Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phalcon storage #743

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions src/OAuth2/Storage/Phalcon/Models/OauthAccessTokens.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php

namespace OAuth2\Storage\Phalcon\Models;

class OauthAccessTokens extends \Phalcon\Mvc\Model
{
/**
*
* @var string
*/
public $access_token;

/**
*
* @var string
*/
public $client_id;

/**
*
* @var string
*/
public $user_id;

/**
*
* @var string
*/
public $expires;

/**
*
* @var string
*/
public $scope;

/**
* Allows to query a set of records that match the specified conditions
*
* @param mixed $parameters
* @return OauthAccessTokens[]
*/
public static function find($parameters = null)
{
return parent::find($parameters);
}

/**
* Allows to query the first record that match the specified conditions
*
* @param mixed $parameters
* @return OauthAccessTokens
*/
public static function findFirst($parameters = null)
{
return parent::findFirst($parameters);
}

/**
* Initialize method for model.
*/
public function initialize()
{
$this->setSource("'oauth__access_tokens'");
$this->belongsTo('user_id', 'OAuth2\Storage\Models\OauthUsers', 'username', array("alias" => "User"));
$this->belongsTo('client_id', 'OAuth2\Storage\Models\OauthClients', 'client_id', array("alias" => "Client"));
}

/**
* Returns table name mapped in the model.
*
* @return string
*/
public function getSource()
{
return 'oauth__access_tokens';
}

/**
* @param mixed $parameters
* @return \OAuth2\Storage\Models\OauthUsers
*/
public function getUser($parameters = null)
{
return $this->getRelated('User', $parameters);
}

/**
* @param mixed $parameters
* @return \OAuth2\Storage\Models\OauthClients
*/
public function getClient($parameters = null)
{
return $this->getRelated('Client', $parameters);
}

}
82 changes: 82 additions & 0 deletions src/OAuth2/Storage/Phalcon/Models/OauthAuthorizationCodes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php

namespace OAuth2\Storage\Phalcon\Models;

class OauthAuthorizationCodes extends \Phalcon\Mvc\Model
{

/**
*
* @var string
*/
public $authorization_code;

/**
*
* @var string
*/
public $client_id;

/**
*
* @var string
*/
public $user_id;

/**
*
* @var string
*/
public $redirect_uri;

/**
*
* @var string
*/
public $expires;

/**
*
* @var string
*/
public $scope;

/**
*
* @var string
*/
public $id_token;

/**
* Returns table name mapped in the model.
*
* @return string
*/
public function getSource()
{
return 'oauth__authorization_codes';
}

/**
* Allows to query a set of records that match the specified conditions
*
* @param mixed $parameters
* @return OauthAuthorizationCodes[]
*/
public static function find($parameters = null)
{
return parent::find($parameters);
}

/**
* Allows to query the first record that match the specified conditions
*
* @param mixed $parameters
* @return OauthAuthorizationCodes
*/
public static function findFirst($parameters = null)
{
return parent::findFirst($parameters);
}

}
92 changes: 92 additions & 0 deletions src/OAuth2/Storage/Phalcon/Models/OauthClients.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php

namespace OAuth2\Storage\Phalcon\Models;

class OauthClients extends \Phalcon\Mvc\Model
{

/**
*
* @var string
*/
public $client_id;

/**
*
* @var string
*/
public $client_secret;

/**
*
* @var string
*/
public $redirect_uri;

/**
*
* @var string
*/
public $grant_types;

/**
*
* @var string
*/
public $scope;

/**
*
* @var string
*/
public $user_id;

/**
* Initialize method for model.
*/
public function initialize()
{
$this->setSource("'oauth__clients'");
$this->belongsTo('user_id', 'OAuth2\Storage\Models\OauthUsers', 'username', array("alias" => "User"));
}

/**
* Returns table name mapped in the model.
*
* @return string
*/
public function getSource()
{
return 'oauth__clients';
}

/**
* Allows to query a set of records that match the specified conditions
*
* @param mixed $parameters
* @return OauthClients[]
*/
public static function find($parameters = null)
{
return parent::find($parameters);
}

/**
* Allows to query the first record that match the specified conditions
*
* @param mixed $parameters
* @return OauthClients
*/
public static function findFirst($parameters = null)
{
return parent::findFirst($parameters);
}

/**
* @param mixed $parameters
* @return OauthUsers
*/
public function getUser($parameters = null){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brace should be on a new line

return $this->getRelated('User', $parameters);
}
}
70 changes: 70 additions & 0 deletions src/OAuth2/Storage/Phalcon/Models/OauthJti.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

namespace OAuth2\Storage\Phalcon\Models;

class OauthJti extends \Phalcon\Mvc\Model
{

/**
*
* @var string
*/
public $issuer;

/**
*
* @var string
*/
public $subject;

/**
*
* @var string
*/
public $audience;

/**
*
* @var string
*/
public $expires;

/**
*
* @var string
*/
public $jti;

/**
* Returns table name mapped in the model.
*
* @return string
*/
public function getSource()
{
return 'oauth__jti';
}

/**
* Allows to query a set of records that match the specified conditions
*
* @param mixed $parameters
* @return OauthJti[]
*/
public static function find($parameters = null)
{
return parent::find($parameters);
}

/**
* Allows to query the first record that match the specified conditions
*
* @param mixed $parameters
* @return OauthJti
*/
public static function findFirst($parameters = null)
{
return parent::findFirst($parameters);
}

}
Loading