Schema

Summary

No summary available.

Source

File: src/BigCommerce/Container/Schema.php

class Schema extends Provider {
	const TABLE_REVIEWS  = 'schema.table.reviews';
	const ROLE_SCHEMA    = 'schema.roles';
	const CUSTOMER_ROLE  = 'schema.roles.customer';

	public function register( Container $container ) {
		$this->tables( $container );
		$this->roles( $container );
	}

	private function tables( Container $container ) {
		$container[ self::TABLE_REVIEWS ] = function( Container $container ) {
			return new Reviews_Table();
		};

		add_action( 'plugins_loaded', $this->create_callback( 'tables_plugins_loaded', function () use ( $container ) {
			$container[ self::TABLE_REVIEWS ]->register_tables();
		} ), 10, 0 );
	}

	private function roles( Container $container ) {
		$container[ self::CUSTOMER_ROLE ] = function ( Container $container ) {
			return new Customer();
		};
		$container[ self::ROLE_SCHEMA ]   = function ( Container $container ) {
			return new User_Roles( [
				$container[ self::CUSTOMER_ROLE ],
			] );
		};
		add_action( 'admin_init', $this->create_callback( 'init_roles', function () use ( $container ) {
			$container[ self::ROLE_SCHEMA ]->register_roles();
		} ), 10, 0 );
	}
}

Methods


User Contributed Notes

You must log in before being able to contribute a note or feedback.