CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C Authorization 3.x API

  • Project:
    • Authorization
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.x
      • 3.x
      • 2.x

Namespaces

  • Authorization
    • Command
    • Controller
    • Exception
    • Middleware
    • Policy
      • Exception

Class OrmResolver

Policy resolver that applies conventions based policy classes for CakePHP ORM Tables, Entities and Queries.

Namespace: Authorization\Policy

Property Summary

  • $appNamespace protected
    string

    Application namespace.

  • $container protected
    Cake\Core\ContainerInterface|null

    The DIC instance from the application

  • $overrides protected
    array<string, string>

    Plugin name overrides.

Method Summary

  • __construct() public

    Constructor

  • findPolicy() protected

    Locate a policy class using conventions

  • getEntityPolicy() protected

    Get a policy for an entity

  • getNamespace() protected

    Returns plugin namespace override if exists.

  • getPolicy() public

    Get a policy for an ORM Table, Entity or Query.

  • getRepositoryPolicy() protected

    Get a policy for a table

Method Detail

__construct() ¶ public

__construct(string $appNamespace = 'App', array<string, string> $overrides = [], Cake\Core\ContainerInterface|null $container = null)

Constructor

Parameters
string $appNamespace optional

The application namespace

array<string, string> $overrides optional

A list of plugin name overrides.

Cake\Core\ContainerInterface|null $container optional

The DIC instance from the application

findPolicy() ¶ protected

findPolicy(string $class, string $name, string $namespace): mixed

Locate a policy class using conventions

Parameters
string $class

The full class name.

string $name

The name suffix of the resource.

string $namespace

The namespace to find the policy in.

Returns
mixed
Throws
Authorization\Policy\Exception\MissingPolicyException
When a policy for the resource has not been defined.

getEntityPolicy() ¶ protected

getEntityPolicy(Cake\Datasource\EntityInterface $entity): mixed

Get a policy for an entity

Parameters
Cake\Datasource\EntityInterface $entity

The entity to get a policy for

Returns
mixed

getNamespace() ¶ protected

getNamespace(string $namespace): string

Returns plugin namespace override if exists.

Parameters
string $namespace

The namespace to find the policy in.

Returns
string

getPolicy() ¶ public

getPolicy(mixed $resource): mixed

Get a policy for an ORM Table, Entity or Query.

The resolver MUST throw the \Authorization\Policy\Exception\MissingPolicyException exception if a policy cannot be resolved for a given resource.

Parameters
mixed $resource

The resource.

Returns
mixed
Throws
Authorization\Policy\Exception\MissingPolicyException
When a policy for the resource has not been defined or cannot be resolved.

getRepositoryPolicy() ¶ protected

getRepositoryPolicy(Cake\Datasource\RepositoryInterface $table): mixed

Get a policy for a table

Parameters
Cake\Datasource\RepositoryInterface $table

The table/repository to get a policy for.

Returns
mixed

Property Detail

$appNamespace ¶ protected

Application namespace.

Type
string

$container ¶ protected

The DIC instance from the application

Type
Cake\Core\ContainerInterface|null

$overrides ¶ protected

Plugin name overrides.

Type
array<string, string>
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs