@@ -20,86 +20,86 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class InputCollection extends Collection |
| 22 | 22 | { |
| 23 | - const COLLECTION_NAME = 'espresso_graphql_inputs'; |
|
| 23 | + const COLLECTION_NAME = 'espresso_graphql_inputs'; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @var CollectionLoader $loader |
|
| 27 | - */ |
|
| 28 | - protected $loader; |
|
| 25 | + /** |
|
| 26 | + * @var CollectionLoader $loader |
|
| 27 | + */ |
|
| 28 | + protected $loader; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * InputCollection constructor |
|
| 32 | - * |
|
| 33 | - * @throws InvalidInterfaceException |
|
| 34 | - */ |
|
| 35 | - public function __construct() |
|
| 36 | - { |
|
| 37 | - parent::__construct( |
|
| 38 | - 'EventEspresso\core\services\graphql\inputs\InputInterface', |
|
| 39 | - InputCollection::COLLECTION_NAME |
|
| 40 | - ); |
|
| 41 | - } |
|
| 30 | + /** |
|
| 31 | + * InputCollection constructor |
|
| 32 | + * |
|
| 33 | + * @throws InvalidInterfaceException |
|
| 34 | + */ |
|
| 35 | + public function __construct() |
|
| 36 | + { |
|
| 37 | + parent::__construct( |
|
| 38 | + 'EventEspresso\core\services\graphql\inputs\InputInterface', |
|
| 39 | + InputCollection::COLLECTION_NAME |
|
| 40 | + ); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @throws CollectionDetailsException |
|
| 46 | - * @throws CollectionLoaderException |
|
| 47 | - * @since $VID:$ |
|
| 48 | - */ |
|
| 49 | - private function loadCollection() |
|
| 50 | - { |
|
| 51 | - if (! $this->loader instanceof CollectionLoader) { |
|
| 52 | - $this->loader = new CollectionLoader( |
|
| 53 | - new CollectionDetails( |
|
| 54 | - // collection name |
|
| 55 | - InputCollection::COLLECTION_NAME, |
|
| 56 | - // collection interface |
|
| 57 | - 'EventEspresso\core\services\graphql\inputs\InputInterface', |
|
| 58 | - // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
| 59 | - apply_filters( |
|
| 60 | - 'FHEE__EventEspresso_core_services_graphql_InputCollection__loadCollection__collection_FQCNs', |
|
| 61 | - ['EventEspresso\core\domain\services\graphql\inputs'] |
|
| 62 | - ), |
|
| 63 | - // filepaths to classes to add |
|
| 64 | - array(), |
|
| 65 | - // file mask to use if parsing folder for files to add |
|
| 66 | - '', |
|
| 67 | - // what to use as identifier for collection entities |
|
| 68 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
| 69 | - CollectionDetails::ID_CLASS_NAME |
|
| 70 | - ), |
|
| 71 | - $this |
|
| 72 | - ); |
|
| 73 | - } |
|
| 74 | - } |
|
| 44 | + /** |
|
| 45 | + * @throws CollectionDetailsException |
|
| 46 | + * @throws CollectionLoaderException |
|
| 47 | + * @since $VID:$ |
|
| 48 | + */ |
|
| 49 | + private function loadCollection() |
|
| 50 | + { |
|
| 51 | + if (! $this->loader instanceof CollectionLoader) { |
|
| 52 | + $this->loader = new CollectionLoader( |
|
| 53 | + new CollectionDetails( |
|
| 54 | + // collection name |
|
| 55 | + InputCollection::COLLECTION_NAME, |
|
| 56 | + // collection interface |
|
| 57 | + 'EventEspresso\core\services\graphql\inputs\InputInterface', |
|
| 58 | + // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
| 59 | + apply_filters( |
|
| 60 | + 'FHEE__EventEspresso_core_services_graphql_InputCollection__loadCollection__collection_FQCNs', |
|
| 61 | + ['EventEspresso\core\domain\services\graphql\inputs'] |
|
| 62 | + ), |
|
| 63 | + // filepaths to classes to add |
|
| 64 | + array(), |
|
| 65 | + // file mask to use if parsing folder for files to add |
|
| 66 | + '', |
|
| 67 | + // what to use as identifier for collection entities |
|
| 68 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
| 69 | + CollectionDetails::ID_CLASS_NAME |
|
| 70 | + ), |
|
| 71 | + $this |
|
| 72 | + ); |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * @return CollectionInterface |
|
| 79 | - * @throws CollectionDetailsException |
|
| 80 | - * @throws CollectionLoaderException |
|
| 81 | - * @since $VID:$ |
|
| 82 | - */ |
|
| 83 | - public function loadInputs() |
|
| 84 | - { |
|
| 85 | - $this->loadCollection(); |
|
| 86 | - return $this->loader->getCollection(); |
|
| 87 | - } |
|
| 77 | + /** |
|
| 78 | + * @return CollectionInterface |
|
| 79 | + * @throws CollectionDetailsException |
|
| 80 | + * @throws CollectionLoaderException |
|
| 81 | + * @since $VID:$ |
|
| 82 | + */ |
|
| 83 | + public function loadInputs() |
|
| 84 | + { |
|
| 85 | + $this->loadCollection(); |
|
| 86 | + return $this->loader->getCollection(); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * getIdentifier |
|
| 92 | - * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
| 93 | - * If no $identifier is supplied, then the fully qualified class name is used |
|
| 94 | - * |
|
| 95 | - * @param $object |
|
| 96 | - * @param mixed $identifier |
|
| 97 | - * @return bool |
|
| 98 | - */ |
|
| 99 | - public function getIdentifier($object, $identifier = null) |
|
| 100 | - { |
|
| 101 | - return ! empty($identifier) |
|
| 102 | - ? $identifier |
|
| 103 | - : get_class($object); |
|
| 104 | - } |
|
| 90 | + /** |
|
| 91 | + * getIdentifier |
|
| 92 | + * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
| 93 | + * If no $identifier is supplied, then the fully qualified class name is used |
|
| 94 | + * |
|
| 95 | + * @param $object |
|
| 96 | + * @param mixed $identifier |
|
| 97 | + * @return bool |
|
| 98 | + */ |
|
| 99 | + public function getIdentifier($object, $identifier = null) |
|
| 100 | + { |
|
| 101 | + return ! empty($identifier) |
|
| 102 | + ? $identifier |
|
| 103 | + : get_class($object); |
|
| 104 | + } |
|
| 105 | 105 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | private function loadCollection() |
| 51 | 51 | { |
| 52 | - if (! $this->loader instanceof CollectionLoader) { |
|
| 52 | + if ( ! $this->loader instanceof CollectionLoader) { |
|
| 53 | 53 | $this->loader = new CollectionLoader( |
| 54 | 54 | new CollectionDetails( |
| 55 | 55 | // collection name |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | private function loadCollection() |
| 51 | 51 | { |
| 52 | - if (! $this->loader instanceof CollectionLoader) { |
|
| 52 | + if ( ! $this->loader instanceof CollectionLoader) { |
|
| 53 | 53 | $this->loader = new CollectionLoader( |
| 54 | 54 | new CollectionDetails( |
| 55 | 55 | // collection name |
@@ -20,89 +20,89 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class TypeCollection extends Collection |
| 22 | 22 | { |
| 23 | - const COLLECTION_NAME = 'espresso_graphql_types'; |
|
| 23 | + const COLLECTION_NAME = 'espresso_graphql_types'; |
|
| 24 | 24 | |
| 25 | - const COLLECTION_INTERFACE = 'EventEspresso\core\services\graphql\types\TypeInterface'; |
|
| 25 | + const COLLECTION_INTERFACE = 'EventEspresso\core\services\graphql\types\TypeInterface'; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var CollectionLoader $loader |
|
| 29 | - */ |
|
| 30 | - protected $loader; |
|
| 27 | + /** |
|
| 28 | + * @var CollectionLoader $loader |
|
| 29 | + */ |
|
| 30 | + protected $loader; |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * TypeCollection constructor |
|
| 35 | - * |
|
| 36 | - * @throws InvalidInterfaceException |
|
| 37 | - */ |
|
| 38 | - public function __construct() |
|
| 39 | - { |
|
| 40 | - parent::__construct( |
|
| 41 | - TypeCollection::COLLECTION_INTERFACE, |
|
| 42 | - TypeCollection::COLLECTION_NAME |
|
| 43 | - ); |
|
| 44 | - } |
|
| 33 | + /** |
|
| 34 | + * TypeCollection constructor |
|
| 35 | + * |
|
| 36 | + * @throws InvalidInterfaceException |
|
| 37 | + */ |
|
| 38 | + public function __construct() |
|
| 39 | + { |
|
| 40 | + parent::__construct( |
|
| 41 | + TypeCollection::COLLECTION_INTERFACE, |
|
| 42 | + TypeCollection::COLLECTION_NAME |
|
| 43 | + ); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @throws CollectionDetailsException |
|
| 49 | - * @throws CollectionLoaderException |
|
| 50 | - * @since $VID:$ |
|
| 51 | - */ |
|
| 52 | - private function loadCollection() |
|
| 53 | - { |
|
| 54 | - if (! $this->loader instanceof CollectionLoader) { |
|
| 55 | - $this->loader = new CollectionLoader( |
|
| 56 | - new CollectionDetails( |
|
| 57 | - // collection name |
|
| 58 | - TypeCollection::COLLECTION_NAME, |
|
| 59 | - // collection interface |
|
| 60 | - TypeCollection::COLLECTION_INTERFACE, |
|
| 61 | - // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
| 62 | - apply_filters( |
|
| 63 | - 'FHEE__EventEspresso_core_services_graphql_TypeCollection__loadCollection__collection_FQCNs', |
|
| 64 | - ['EventEspresso\core\domain\services\graphql\types'] |
|
| 65 | - ), |
|
| 66 | - // filepaths to classes to add |
|
| 67 | - array(), |
|
| 68 | - // file mask to use if parsing folder for files to add |
|
| 69 | - '', |
|
| 70 | - // what to use as identifier for collection entities |
|
| 71 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
| 72 | - CollectionDetails::ID_CLASS_NAME |
|
| 73 | - ), |
|
| 74 | - $this |
|
| 75 | - ); |
|
| 76 | - } |
|
| 77 | - } |
|
| 47 | + /** |
|
| 48 | + * @throws CollectionDetailsException |
|
| 49 | + * @throws CollectionLoaderException |
|
| 50 | + * @since $VID:$ |
|
| 51 | + */ |
|
| 52 | + private function loadCollection() |
|
| 53 | + { |
|
| 54 | + if (! $this->loader instanceof CollectionLoader) { |
|
| 55 | + $this->loader = new CollectionLoader( |
|
| 56 | + new CollectionDetails( |
|
| 57 | + // collection name |
|
| 58 | + TypeCollection::COLLECTION_NAME, |
|
| 59 | + // collection interface |
|
| 60 | + TypeCollection::COLLECTION_INTERFACE, |
|
| 61 | + // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
| 62 | + apply_filters( |
|
| 63 | + 'FHEE__EventEspresso_core_services_graphql_TypeCollection__loadCollection__collection_FQCNs', |
|
| 64 | + ['EventEspresso\core\domain\services\graphql\types'] |
|
| 65 | + ), |
|
| 66 | + // filepaths to classes to add |
|
| 67 | + array(), |
|
| 68 | + // file mask to use if parsing folder for files to add |
|
| 69 | + '', |
|
| 70 | + // what to use as identifier for collection entities |
|
| 71 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
| 72 | + CollectionDetails::ID_CLASS_NAME |
|
| 73 | + ), |
|
| 74 | + $this |
|
| 75 | + ); |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * @return CollectionInterface |
|
| 82 | - * @throws CollectionDetailsException |
|
| 83 | - * @throws CollectionLoaderException |
|
| 84 | - * @since $VID:$ |
|
| 85 | - */ |
|
| 86 | - public function loadTypes() |
|
| 87 | - { |
|
| 88 | - $this->loadCollection(); |
|
| 89 | - return $this->loader->getCollection(); |
|
| 90 | - } |
|
| 80 | + /** |
|
| 81 | + * @return CollectionInterface |
|
| 82 | + * @throws CollectionDetailsException |
|
| 83 | + * @throws CollectionLoaderException |
|
| 84 | + * @since $VID:$ |
|
| 85 | + */ |
|
| 86 | + public function loadTypes() |
|
| 87 | + { |
|
| 88 | + $this->loadCollection(); |
|
| 89 | + return $this->loader->getCollection(); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * getIdentifier |
|
| 95 | - * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
| 96 | - * If no $identifier is supplied, then the fully qualified class name is used |
|
| 97 | - * |
|
| 98 | - * @param $object |
|
| 99 | - * @param mixed $identifier |
|
| 100 | - * @return bool |
|
| 101 | - */ |
|
| 102 | - public function getIdentifier($object, $identifier = null) |
|
| 103 | - { |
|
| 104 | - return ! empty($identifier) |
|
| 105 | - ? $identifier |
|
| 106 | - : get_class($object); |
|
| 107 | - } |
|
| 93 | + /** |
|
| 94 | + * getIdentifier |
|
| 95 | + * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
| 96 | + * If no $identifier is supplied, then the fully qualified class name is used |
|
| 97 | + * |
|
| 98 | + * @param $object |
|
| 99 | + * @param mixed $identifier |
|
| 100 | + * @return bool |
|
| 101 | + */ |
|
| 102 | + public function getIdentifier($object, $identifier = null) |
|
| 103 | + { |
|
| 104 | + return ! empty($identifier) |
|
| 105 | + ? $identifier |
|
| 106 | + : get_class($object); |
|
| 107 | + } |
|
| 108 | 108 | } |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | $inputFields = []; |
| 69 | 69 | foreach ($input->fields() as $field) { |
| 70 | 70 | $fieldName = $field->name(); |
| 71 | - $inputFields[ $fieldName ] = $field->toArray(); |
|
| 71 | + $inputFields[$fieldName] = $field->toArray(); |
|
| 72 | 72 | } |
| 73 | 73 | // Register the input type. |
| 74 | 74 | register_graphql_input_type( |
@@ -17,65 +17,65 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class InputsManager implements GQLManagerInterface |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * @var InputCollection|InputInterface[] $inputs |
|
| 22 | - */ |
|
| 23 | - private $inputs; |
|
| 20 | + /** |
|
| 21 | + * @var InputCollection|InputInterface[] $inputs |
|
| 22 | + */ |
|
| 23 | + private $inputs; |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * InputsManager constructor. |
|
| 28 | - * |
|
| 29 | - * @param InputCollection|InputInterface[] $inputs |
|
| 30 | - */ |
|
| 31 | - public function __construct(InputCollection $inputs) |
|
| 32 | - { |
|
| 33 | - $this->inputs = $inputs; |
|
| 34 | - } |
|
| 26 | + /** |
|
| 27 | + * InputsManager constructor. |
|
| 28 | + * |
|
| 29 | + * @param InputCollection|InputInterface[] $inputs |
|
| 30 | + */ |
|
| 31 | + public function __construct(InputCollection $inputs) |
|
| 32 | + { |
|
| 33 | + $this->inputs = $inputs; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @throws CollectionDetailsException |
|
| 39 | - * @throws CollectionLoaderException |
|
| 40 | - * @since $VID:$ |
|
| 41 | - */ |
|
| 42 | - public function init() |
|
| 43 | - { |
|
| 44 | - $this->inputs->loadInputs(); |
|
| 45 | - add_action('graphql_register_types', [$this, 'configureInputs'], 9); |
|
| 46 | - } |
|
| 37 | + /** |
|
| 38 | + * @throws CollectionDetailsException |
|
| 39 | + * @throws CollectionLoaderException |
|
| 40 | + * @since $VID:$ |
|
| 41 | + */ |
|
| 42 | + public function init() |
|
| 43 | + { |
|
| 44 | + $this->inputs->loadInputs(); |
|
| 45 | + add_action('graphql_register_types', [$this, 'configureInputs'], 9); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @since $VID:$ |
|
| 51 | - */ |
|
| 52 | - public function configureInputs() |
|
| 53 | - { |
|
| 54 | - // loop through the collection of inputs and register their fields |
|
| 55 | - foreach ($this->inputs as $input) { |
|
| 56 | - $this->registerInput($input); |
|
| 57 | - } |
|
| 58 | - } |
|
| 49 | + /** |
|
| 50 | + * @since $VID:$ |
|
| 51 | + */ |
|
| 52 | + public function configureInputs() |
|
| 53 | + { |
|
| 54 | + // loop through the collection of inputs and register their fields |
|
| 55 | + foreach ($this->inputs as $input) { |
|
| 56 | + $this->registerInput($input); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @param InputInterface $input |
|
| 63 | - * @since $VID:$ |
|
| 64 | - */ |
|
| 65 | - public function registerInput(InputInterface $input) |
|
| 66 | - { |
|
| 67 | - $inputFields = []; |
|
| 68 | - foreach ($input->fields() as $field) { |
|
| 69 | - $fieldName = $field->name(); |
|
| 70 | - $inputFields[ $fieldName ] = $field->toArray(); |
|
| 71 | - } |
|
| 72 | - // Register the input type. |
|
| 73 | - register_graphql_input_type( |
|
| 74 | - $input->name(), |
|
| 75 | - [ |
|
| 76 | - 'description' => $input->description(), |
|
| 77 | - 'fields' => $inputFields, |
|
| 78 | - ] |
|
| 79 | - ); |
|
| 80 | - } |
|
| 61 | + /** |
|
| 62 | + * @param InputInterface $input |
|
| 63 | + * @since $VID:$ |
|
| 64 | + */ |
|
| 65 | + public function registerInput(InputInterface $input) |
|
| 66 | + { |
|
| 67 | + $inputFields = []; |
|
| 68 | + foreach ($input->fields() as $field) { |
|
| 69 | + $fieldName = $field->name(); |
|
| 70 | + $inputFields[ $fieldName ] = $field->toArray(); |
|
| 71 | + } |
|
| 72 | + // Register the input type. |
|
| 73 | + register_graphql_input_type( |
|
| 74 | + $input->name(), |
|
| 75 | + [ |
|
| 76 | + 'description' => $input->description(), |
|
| 77 | + 'fields' => $inputFields, |
|
| 78 | + ] |
|
| 79 | + ); |
|
| 80 | + } |
|
| 81 | 81 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | private function loadCollection() |
| 51 | 51 | { |
| 52 | - if (! $this->loader instanceof CollectionLoader) { |
|
| 52 | + if ( ! $this->loader instanceof CollectionLoader) { |
|
| 53 | 53 | $this->loader = new CollectionLoader( |
| 54 | 54 | new CollectionDetails( |
| 55 | 55 | // collection name |
@@ -20,86 +20,86 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class ConnectionCollection extends Collection |
| 22 | 22 | { |
| 23 | - const COLLECTION_NAME = 'espresso_graphql_connections'; |
|
| 23 | + const COLLECTION_NAME = 'espresso_graphql_connections'; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @var CollectionLoader $loader |
|
| 27 | - */ |
|
| 28 | - protected $loader; |
|
| 25 | + /** |
|
| 26 | + * @var CollectionLoader $loader |
|
| 27 | + */ |
|
| 28 | + protected $loader; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * ConnectionCollection constructor |
|
| 32 | - * |
|
| 33 | - * @throws InvalidInterfaceException |
|
| 34 | - */ |
|
| 35 | - public function __construct() |
|
| 36 | - { |
|
| 37 | - parent::__construct( |
|
| 38 | - 'EventEspresso\core\services\graphql\connections\ConnectionInterface', |
|
| 39 | - ConnectionCollection::COLLECTION_NAME |
|
| 40 | - ); |
|
| 41 | - } |
|
| 30 | + /** |
|
| 31 | + * ConnectionCollection constructor |
|
| 32 | + * |
|
| 33 | + * @throws InvalidInterfaceException |
|
| 34 | + */ |
|
| 35 | + public function __construct() |
|
| 36 | + { |
|
| 37 | + parent::__construct( |
|
| 38 | + 'EventEspresso\core\services\graphql\connections\ConnectionInterface', |
|
| 39 | + ConnectionCollection::COLLECTION_NAME |
|
| 40 | + ); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @throws CollectionDetailsException |
|
| 46 | - * @throws CollectionLoaderException |
|
| 47 | - * @since $VID:$ |
|
| 48 | - */ |
|
| 49 | - private function loadCollection() |
|
| 50 | - { |
|
| 51 | - if (! $this->loader instanceof CollectionLoader) { |
|
| 52 | - $this->loader = new CollectionLoader( |
|
| 53 | - new CollectionDetails( |
|
| 54 | - // collection name |
|
| 55 | - ConnectionCollection::COLLECTION_NAME, |
|
| 56 | - // collection interface |
|
| 57 | - 'EventEspresso\core\services\graphql\connections\ConnectionInterface', |
|
| 58 | - // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
| 59 | - apply_filters( |
|
| 60 | - 'FHEE__EventEspresso_core_services_graphql_ConnectionCollection__loadCollection__collection_FQCNs', |
|
| 61 | - ['EventEspresso\core\domain\services\graphql\connections'] |
|
| 62 | - ), |
|
| 63 | - // filepaths to classes to add |
|
| 64 | - array(), |
|
| 65 | - // file mask to use if parsing folder for files to add |
|
| 66 | - '', |
|
| 67 | - // what to use as identifier for collection entities |
|
| 68 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
| 69 | - CollectionDetails::ID_CLASS_NAME |
|
| 70 | - ), |
|
| 71 | - $this |
|
| 72 | - ); |
|
| 73 | - } |
|
| 74 | - } |
|
| 44 | + /** |
|
| 45 | + * @throws CollectionDetailsException |
|
| 46 | + * @throws CollectionLoaderException |
|
| 47 | + * @since $VID:$ |
|
| 48 | + */ |
|
| 49 | + private function loadCollection() |
|
| 50 | + { |
|
| 51 | + if (! $this->loader instanceof CollectionLoader) { |
|
| 52 | + $this->loader = new CollectionLoader( |
|
| 53 | + new CollectionDetails( |
|
| 54 | + // collection name |
|
| 55 | + ConnectionCollection::COLLECTION_NAME, |
|
| 56 | + // collection interface |
|
| 57 | + 'EventEspresso\core\services\graphql\connections\ConnectionInterface', |
|
| 58 | + // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
| 59 | + apply_filters( |
|
| 60 | + 'FHEE__EventEspresso_core_services_graphql_ConnectionCollection__loadCollection__collection_FQCNs', |
|
| 61 | + ['EventEspresso\core\domain\services\graphql\connections'] |
|
| 62 | + ), |
|
| 63 | + // filepaths to classes to add |
|
| 64 | + array(), |
|
| 65 | + // file mask to use if parsing folder for files to add |
|
| 66 | + '', |
|
| 67 | + // what to use as identifier for collection entities |
|
| 68 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
| 69 | + CollectionDetails::ID_CLASS_NAME |
|
| 70 | + ), |
|
| 71 | + $this |
|
| 72 | + ); |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * @return CollectionInterface |
|
| 79 | - * @throws CollectionDetailsException |
|
| 80 | - * @throws CollectionLoaderException |
|
| 81 | - * @since $VID:$ |
|
| 82 | - */ |
|
| 83 | - public function loadConnections() |
|
| 84 | - { |
|
| 85 | - $this->loadCollection(); |
|
| 86 | - return $this->loader->getCollection(); |
|
| 87 | - } |
|
| 77 | + /** |
|
| 78 | + * @return CollectionInterface |
|
| 79 | + * @throws CollectionDetailsException |
|
| 80 | + * @throws CollectionLoaderException |
|
| 81 | + * @since $VID:$ |
|
| 82 | + */ |
|
| 83 | + public function loadConnections() |
|
| 84 | + { |
|
| 85 | + $this->loadCollection(); |
|
| 86 | + return $this->loader->getCollection(); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * getIdentifier |
|
| 92 | - * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
| 93 | - * If no $identifier is supplied, then the fully qualified class name is used |
|
| 94 | - * |
|
| 95 | - * @param $object |
|
| 96 | - * @param mixed $identifier |
|
| 97 | - * @return bool |
|
| 98 | - */ |
|
| 99 | - public function getIdentifier($object, $identifier = null) |
|
| 100 | - { |
|
| 101 | - return ! empty($identifier) |
|
| 102 | - ? $identifier |
|
| 103 | - : get_class($object); |
|
| 104 | - } |
|
| 90 | + /** |
|
| 91 | + * getIdentifier |
|
| 92 | + * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
| 93 | + * If no $identifier is supplied, then the fully qualified class name is used |
|
| 94 | + * |
|
| 95 | + * @param $object |
|
| 96 | + * @param mixed $identifier |
|
| 97 | + * @return bool |
|
| 98 | + */ |
|
| 99 | + public function getIdentifier($object, $identifier = null) |
|
| 100 | + { |
|
| 101 | + return ! empty($identifier) |
|
| 102 | + ? $identifier |
|
| 103 | + : get_class($object); |
|
| 104 | + } |
|
| 105 | 105 | } |
@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | // unfortunately, this needs to be done upon INCLUSION of this file, |
| 13 | 13 | // instead of construction, because it only gets constructed on first page load |
| 14 | 14 | // (all other times it gets resurrected from a wordpress option) |
| 15 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_10_0_stages/*'); |
|
| 15 | +$stages = glob(EE_CORE.'data_migration_scripts/4_10_0_stages/*'); |
|
| 16 | 16 | $class_to_filepath = []; |
| 17 | 17 | foreach ($stages as $filepath) { |
| 18 | 18 | $matches = []; |
| 19 | 19 | preg_match('~4_10_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
| 20 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 20 | + $class_to_filepath[$matches[1]] = $filepath; |
|
| 21 | 21 | } |
| 22 | 22 | // give addons a chance to autoload their stages too |
| 23 | 23 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_10_0__autoloaded_stages', $class_to_filepath); |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | $version_string = $version_array['Core']; |
| 68 | 68 | if (version_compare($version_string, '4.10.0.decaf', '<') && version_compare($version_string, '4.9.0.decaf', '>=')) { |
| 69 | 69 | return true; |
| 70 | - } elseif (! $version_string) { |
|
| 70 | + } elseif ( ! $version_string) { |
|
| 71 | 71 | // echo "no version string provided: $version_string"; |
| 72 | 72 | // no version string provided... this must be pre 4.3 |
| 73 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
| 73 | + return false; // changed mind. dont want people thinking they should migrate yet because they cant |
|
| 74 | 74 | } |
| 75 | 75 | return false; |
| 76 | 76 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function schema_changes_before_migration() |
| 84 | 84 | { |
| 85 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 85 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
| 86 | 86 | $now_in_mysql = current_time('mysql', true); |
| 87 | 87 | $table_name = 'esp_answer'; |
| 88 | 88 | $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | { |
| 634 | 634 | global $wpdb; |
| 635 | 635 | $wpdb->update( |
| 636 | - $wpdb->prefix . 'esp_payment_method', |
|
| 636 | + $wpdb->prefix.'esp_payment_method', |
|
| 637 | 637 | [ |
| 638 | 638 | 'PMD_type' => 'Admin_Only', |
| 639 | 639 | 'PMD_scope' => serialize(array()) |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | $stages = glob(EE_CORE . 'data_migration_scripts/4_10_0_stages/*'); |
| 13 | 13 | $class_to_filepath = []; |
| 14 | 14 | foreach ($stages as $filepath) { |
| 15 | - $matches = []; |
|
| 16 | - preg_match('~4_10_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
| 17 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 15 | + $matches = []; |
|
| 16 | + preg_match('~4_10_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
| 17 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 18 | 18 | } |
| 19 | 19 | // give addons a chance to autoload their stages too |
| 20 | 20 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_10_0__autoloaded_stages', $class_to_filepath); |
@@ -31,66 +31,66 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | class EE_DMS_Core_4_10_0 extends EE_Data_Migration_Script_Base |
| 33 | 33 | { |
| 34 | - /** |
|
| 35 | - * |
|
| 36 | - * @param TableManager $table_manager |
|
| 37 | - * @param TableAnalysis $table_analysis |
|
| 38 | - */ |
|
| 39 | - public function __construct( |
|
| 40 | - TableManager $table_manager = null, |
|
| 41 | - TableAnalysis $table_analysis = null, |
|
| 42 | - EE_DMS_Core_4_9_0 $dms_4_9 |
|
| 43 | - ) { |
|
| 44 | - $this->previous_dms = $dms_4_9; |
|
| 45 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.10.0", "event_espresso"); |
|
| 46 | - $this->_priority = 10; |
|
| 47 | - $this->_migration_stages = array( |
|
| 48 | - new EE_DMS_4_10_0_Event_Question_Group(), |
|
| 49 | - ); |
|
| 50 | - parent::__construct($table_manager, $table_analysis); |
|
| 51 | - } |
|
| 34 | + /** |
|
| 35 | + * |
|
| 36 | + * @param TableManager $table_manager |
|
| 37 | + * @param TableAnalysis $table_analysis |
|
| 38 | + */ |
|
| 39 | + public function __construct( |
|
| 40 | + TableManager $table_manager = null, |
|
| 41 | + TableAnalysis $table_analysis = null, |
|
| 42 | + EE_DMS_Core_4_9_0 $dms_4_9 |
|
| 43 | + ) { |
|
| 44 | + $this->previous_dms = $dms_4_9; |
|
| 45 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.10.0", "event_espresso"); |
|
| 46 | + $this->_priority = 10; |
|
| 47 | + $this->_migration_stages = array( |
|
| 48 | + new EE_DMS_4_10_0_Event_Question_Group(), |
|
| 49 | + ); |
|
| 50 | + parent::__construct($table_manager, $table_analysis); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Whether to migrate or not. |
|
| 57 | - * |
|
| 58 | - * @param array $version_array |
|
| 59 | - * @return bool |
|
| 60 | - */ |
|
| 61 | - public function can_migrate_from_version($version_array) |
|
| 62 | - { |
|
| 63 | - $version_string = $version_array['Core']; |
|
| 64 | - if (version_compare($version_string, '4.10.0.decaf', '<') && version_compare($version_string, '4.9.0.decaf', '>=')) { |
|
| 65 | - return true; |
|
| 66 | - } elseif (! $version_string) { |
|
| 67 | - // echo "no version string provided: $version_string"; |
|
| 68 | - // no version string provided... this must be pre 4.3 |
|
| 69 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
| 70 | - } |
|
| 71 | - return false; |
|
| 72 | - } |
|
| 55 | + /** |
|
| 56 | + * Whether to migrate or not. |
|
| 57 | + * |
|
| 58 | + * @param array $version_array |
|
| 59 | + * @return bool |
|
| 60 | + */ |
|
| 61 | + public function can_migrate_from_version($version_array) |
|
| 62 | + { |
|
| 63 | + $version_string = $version_array['Core']; |
|
| 64 | + if (version_compare($version_string, '4.10.0.decaf', '<') && version_compare($version_string, '4.9.0.decaf', '>=')) { |
|
| 65 | + return true; |
|
| 66 | + } elseif (! $version_string) { |
|
| 67 | + // echo "no version string provided: $version_string"; |
|
| 68 | + // no version string provided... this must be pre 4.3 |
|
| 69 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
| 70 | + } |
|
| 71 | + return false; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | 74 | |
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * @return bool |
|
| 78 | - */ |
|
| 79 | - public function schema_changes_before_migration() |
|
| 80 | - { |
|
| 81 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 82 | - $now_in_mysql = current_time('mysql', true); |
|
| 83 | - $table_name = 'esp_answer'; |
|
| 84 | - $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 76 | + /** |
|
| 77 | + * @return bool |
|
| 78 | + */ |
|
| 79 | + public function schema_changes_before_migration() |
|
| 80 | + { |
|
| 81 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 82 | + $now_in_mysql = current_time('mysql', true); |
|
| 83 | + $table_name = 'esp_answer'; |
|
| 84 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 85 | 85 | REG_ID int(10) unsigned NOT NULL, |
| 86 | 86 | QST_ID int(10) unsigned NOT NULL, |
| 87 | 87 | ANS_value text NOT NULL, |
| 88 | 88 | PRIMARY KEY (ANS_ID), |
| 89 | 89 | KEY REG_ID (REG_ID), |
| 90 | 90 | KEY QST_ID (QST_ID)"; |
| 91 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 92 | - $table_name = 'esp_attendee_meta'; |
|
| 93 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 91 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 92 | + $table_name = 'esp_attendee_meta'; |
|
| 93 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 94 | 94 | ATT_ID bigint(20) unsigned NOT NULL, |
| 95 | 95 | ATT_fname varchar(45) NOT NULL, |
| 96 | 96 | ATT_lname varchar(45) NOT NULL, |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | KEY ATT_email (ATT_email(191)), |
| 108 | 108 | KEY ATT_lname (ATT_lname), |
| 109 | 109 | KEY ATT_fname (ATT_fname)"; |
| 110 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 111 | - $table_name = 'esp_checkin'; |
|
| 112 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 110 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 111 | + $table_name = 'esp_checkin'; |
|
| 112 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 113 | 113 | REG_ID int(10) unsigned NOT NULL, |
| 114 | 114 | DTT_ID int(10) unsigned NOT NULL, |
| 115 | 115 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | PRIMARY KEY (CHK_ID), |
| 118 | 118 | KEY REG_ID (REG_ID), |
| 119 | 119 | KEY DTT_ID (DTT_ID)"; |
| 120 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 121 | - $table_name = 'esp_country'; |
|
| 122 | - $sql = "CNT_ISO varchar(2) NOT NULL, |
|
| 120 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 121 | + $table_name = 'esp_country'; |
|
| 122 | + $sql = "CNT_ISO varchar(2) NOT NULL, |
|
| 123 | 123 | CNT_ISO3 varchar(3) NOT NULL, |
| 124 | 124 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
| 125 | 125 | CNT_name varchar(45) NOT NULL, |
@@ -135,18 +135,18 @@ discard block |
||
| 135 | 135 | CNT_is_EU tinyint(1) DEFAULT '0', |
| 136 | 136 | CNT_active tinyint(1) DEFAULT '0', |
| 137 | 137 | PRIMARY KEY (CNT_ISO)"; |
| 138 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 139 | - $table_name = 'esp_currency'; |
|
| 140 | - $sql = "CUR_code varchar(6) NOT NULL, |
|
| 138 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 139 | + $table_name = 'esp_currency'; |
|
| 140 | + $sql = "CUR_code varchar(6) NOT NULL, |
|
| 141 | 141 | CUR_single varchar(45) DEFAULT 'dollar', |
| 142 | 142 | CUR_plural varchar(45) DEFAULT 'dollars', |
| 143 | 143 | CUR_sign varchar(45) DEFAULT '$', |
| 144 | 144 | CUR_dec_plc varchar(1) NOT NULL DEFAULT '2', |
| 145 | 145 | CUR_active tinyint(1) DEFAULT '0', |
| 146 | 146 | PRIMARY KEY (CUR_code)"; |
| 147 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 148 | - $table_name = 'esp_datetime'; |
|
| 149 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 147 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 148 | + $table_name = 'esp_datetime'; |
|
| 149 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 150 | 150 | EVT_ID bigint(20) unsigned NOT NULL, |
| 151 | 151 | DTT_name varchar(255) NOT NULL DEFAULT '', |
| 152 | 152 | DTT_description text NOT NULL, |
@@ -163,25 +163,25 @@ discard block |
||
| 163 | 163 | KEY DTT_EVT_start (DTT_EVT_start), |
| 164 | 164 | KEY EVT_ID (EVT_ID), |
| 165 | 165 | KEY DTT_is_primary (DTT_is_primary)"; |
| 166 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 167 | - $table_name = "esp_datetime_ticket"; |
|
| 168 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 166 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 167 | + $table_name = "esp_datetime_ticket"; |
|
| 168 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 169 | 169 | DTT_ID int(10) unsigned NOT NULL, |
| 170 | 170 | TKT_ID int(10) unsigned NOT NULL, |
| 171 | 171 | PRIMARY KEY (DTK_ID), |
| 172 | 172 | KEY DTT_ID (DTT_ID), |
| 173 | 173 | KEY TKT_ID (TKT_ID)"; |
| 174 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 175 | - $table_name = 'esp_event_message_template'; |
|
| 176 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
| 174 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 175 | + $table_name = 'esp_event_message_template'; |
|
| 176 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
| 177 | 177 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
| 178 | 178 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
| 179 | 179 | PRIMARY KEY (EMT_ID), |
| 180 | 180 | KEY EVT_ID (EVT_ID), |
| 181 | 181 | KEY GRP_ID (GRP_ID)"; |
| 182 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 183 | - $table_name = 'esp_event_meta'; |
|
| 184 | - $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
| 182 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 183 | + $table_name = 'esp_event_meta'; |
|
| 184 | + $sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
|
| 185 | 185 | EVT_ID bigint(20) unsigned NOT NULL, |
| 186 | 186 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
| 187 | 187 | EVT_display_ticket_selector tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -196,9 +196,9 @@ discard block |
||
| 196 | 196 | EVT_donations tinyint(1) NULL, |
| 197 | 197 | PRIMARY KEY (EVTM_ID), |
| 198 | 198 | KEY EVT_ID (EVT_ID)"; |
| 199 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 200 | - $table_name = 'esp_event_question_group'; |
|
| 201 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 199 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 200 | + $table_name = 'esp_event_question_group'; |
|
| 201 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 202 | 202 | EVT_ID bigint(20) unsigned NOT NULL, |
| 203 | 203 | QSG_ID int(10) unsigned NOT NULL, |
| 204 | 204 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
@@ -206,25 +206,25 @@ discard block |
||
| 206 | 206 | PRIMARY KEY (EQG_ID), |
| 207 | 207 | KEY EVT_ID (EVT_ID), |
| 208 | 208 | KEY QSG_ID (QSG_ID)"; |
| 209 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 210 | - $table_name = 'esp_event_venue'; |
|
| 211 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 209 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 210 | + $table_name = 'esp_event_venue'; |
|
| 211 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 212 | 212 | EVT_ID bigint(20) unsigned NOT NULL, |
| 213 | 213 | VNU_ID bigint(20) unsigned NOT NULL, |
| 214 | 214 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
| 215 | 215 | PRIMARY KEY (EVV_ID)"; |
| 216 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 217 | - $table_name = 'esp_extra_meta'; |
|
| 218 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 216 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 217 | + $table_name = 'esp_extra_meta'; |
|
| 218 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 219 | 219 | OBJ_ID int(11) DEFAULT NULL, |
| 220 | 220 | EXM_type varchar(45) DEFAULT NULL, |
| 221 | 221 | EXM_key varchar(45) DEFAULT NULL, |
| 222 | 222 | EXM_value text, |
| 223 | 223 | PRIMARY KEY (EXM_ID), |
| 224 | 224 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
| 225 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 226 | - $table_name = 'esp_extra_join'; |
|
| 227 | - $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 225 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 226 | + $table_name = 'esp_extra_join'; |
|
| 227 | + $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 228 | 228 | EXJ_first_model_id varchar(6) NOT NULL, |
| 229 | 229 | EXJ_first_model_name varchar(20) NOT NULL, |
| 230 | 230 | EXJ_second_model_id varchar(6) NOT NULL, |
@@ -232,9 +232,9 @@ discard block |
||
| 232 | 232 | PRIMARY KEY (EXJ_ID), |
| 233 | 233 | KEY first_model (EXJ_first_model_name,EXJ_first_model_id), |
| 234 | 234 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
| 235 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 236 | - $table_name = 'esp_line_item'; |
|
| 237 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 235 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 236 | + $table_name = 'esp_line_item'; |
|
| 237 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 238 | 238 | LIN_code varchar(245) NOT NULL DEFAULT '', |
| 239 | 239 | TXN_ID int(11) DEFAULT NULL, |
| 240 | 240 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -255,9 +255,9 @@ discard block |
||
| 255 | 255 | KEY txn_type_timestamp (TXN_ID,LIN_type,LIN_timestamp), |
| 256 | 256 | KEY txn_obj_id_obj_type (TXN_ID,OBJ_ID,OBJ_type), |
| 257 | 257 | KEY obj_id_obj_type (OBJ_ID,OBJ_type)"; |
| 258 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 259 | - $table_name = 'esp_log'; |
|
| 260 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 258 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 259 | + $table_name = 'esp_log'; |
|
| 260 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 261 | 261 | LOG_time datetime DEFAULT NULL, |
| 262 | 262 | OBJ_ID varchar(45) DEFAULT NULL, |
| 263 | 263 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -268,9 +268,9 @@ discard block |
||
| 268 | 268 | KEY LOG_time (LOG_time), |
| 269 | 269 | KEY OBJ (OBJ_type,OBJ_ID), |
| 270 | 270 | KEY LOG_type (LOG_type)"; |
| 271 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 272 | - $table_name = 'esp_message'; |
|
| 273 | - $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
| 271 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 272 | + $table_name = 'esp_message'; |
|
| 273 | + $sql = "MSG_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
| 274 | 274 | GRP_ID int(10) unsigned NULL, |
| 275 | 275 | MSG_token varchar(255) NULL, |
| 276 | 276 | TXN_ID int(10) unsigned NULL, |
@@ -302,18 +302,18 @@ discard block |
||
| 302 | 302 | KEY STS_ID (STS_ID), |
| 303 | 303 | KEY MSG_created (MSG_created), |
| 304 | 304 | KEY MSG_modified (MSG_modified)"; |
| 305 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 306 | - $table_name = 'esp_message_template'; |
|
| 307 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 305 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 306 | + $table_name = 'esp_message_template'; |
|
| 307 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 308 | 308 | GRP_ID int(10) unsigned NOT NULL, |
| 309 | 309 | MTP_context varchar(50) NOT NULL, |
| 310 | 310 | MTP_template_field varchar(30) NOT NULL, |
| 311 | 311 | MTP_content text NOT NULL, |
| 312 | 312 | PRIMARY KEY (MTP_ID), |
| 313 | 313 | KEY GRP_ID (GRP_ID)"; |
| 314 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 315 | - $table_name = 'esp_message_template_group'; |
|
| 316 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 314 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 315 | + $table_name = 'esp_message_template_group'; |
|
| 316 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 317 | 317 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
| 318 | 318 | MTP_name varchar(245) NOT NULL DEFAULT '', |
| 319 | 319 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -325,9 +325,9 @@ discard block |
||
| 325 | 325 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
| 326 | 326 | PRIMARY KEY (GRP_ID), |
| 327 | 327 | KEY MTP_user_id (MTP_user_id)"; |
| 328 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 329 | - $table_name = 'esp_payment'; |
|
| 330 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 328 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 329 | + $table_name = 'esp_payment'; |
|
| 330 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 331 | 331 | TXN_ID int(10) unsigned DEFAULT NULL, |
| 332 | 332 | STS_ID varchar(3) DEFAULT NULL, |
| 333 | 333 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -344,9 +344,9 @@ discard block |
||
| 344 | 344 | PRIMARY KEY (PAY_ID), |
| 345 | 345 | KEY PAY_timestamp (PAY_timestamp), |
| 346 | 346 | KEY TXN_ID (TXN_ID)"; |
| 347 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 348 | - $table_name = 'esp_payment_method'; |
|
| 349 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 347 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 348 | + $table_name = 'esp_payment_method'; |
|
| 349 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 350 | 350 | PMD_type varchar(124) DEFAULT NULL, |
| 351 | 351 | PMD_name varchar(255) DEFAULT NULL, |
| 352 | 352 | PMD_desc text, |
@@ -362,24 +362,24 @@ discard block |
||
| 362 | 362 | PRIMARY KEY (PMD_ID), |
| 363 | 363 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
| 364 | 364 | KEY PMD_type (PMD_type)"; |
| 365 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 366 | - $table_name = "esp_ticket_price"; |
|
| 367 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 365 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 366 | + $table_name = "esp_ticket_price"; |
|
| 367 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 368 | 368 | TKT_ID int(10) unsigned NOT NULL, |
| 369 | 369 | PRC_ID int(10) unsigned NOT NULL, |
| 370 | 370 | PRIMARY KEY (TKP_ID), |
| 371 | 371 | KEY TKT_ID (TKT_ID), |
| 372 | 372 | KEY PRC_ID (PRC_ID)"; |
| 373 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 374 | - $table_name = "esp_ticket_template"; |
|
| 375 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 373 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 374 | + $table_name = "esp_ticket_template"; |
|
| 375 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 376 | 376 | TTM_name varchar(45) NOT NULL, |
| 377 | 377 | TTM_description text, |
| 378 | 378 | TTM_file varchar(45), |
| 379 | 379 | PRIMARY KEY (TTM_ID)"; |
| 380 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 381 | - $table_name = 'esp_question'; |
|
| 382 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 380 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 381 | + $table_name = 'esp_question'; |
|
| 382 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 383 | 383 | QST_display_text text NOT NULL, |
| 384 | 384 | QST_admin_label varchar(255) NOT NULL, |
| 385 | 385 | QST_system varchar(25) DEFAULT NULL, |
@@ -393,18 +393,18 @@ discard block |
||
| 393 | 393 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
| 394 | 394 | PRIMARY KEY (QST_ID), |
| 395 | 395 | KEY QST_order (QST_order)'; |
| 396 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 397 | - $table_name = 'esp_question_group_question'; |
|
| 398 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 396 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 397 | + $table_name = 'esp_question_group_question'; |
|
| 398 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 399 | 399 | QSG_ID int(10) unsigned NOT NULL, |
| 400 | 400 | QST_ID int(10) unsigned NOT NULL, |
| 401 | 401 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
| 402 | 402 | PRIMARY KEY (QGQ_ID), |
| 403 | 403 | KEY QST_ID (QST_ID), |
| 404 | 404 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
| 405 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 406 | - $table_name = 'esp_question_option'; |
|
| 407 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 405 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 406 | + $table_name = 'esp_question_option'; |
|
| 407 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 408 | 408 | QSO_value varchar(255) NOT NULL, |
| 409 | 409 | QSO_desc text NOT NULL, |
| 410 | 410 | QST_ID int(10) unsigned NOT NULL, |
@@ -414,9 +414,9 @@ discard block |
||
| 414 | 414 | PRIMARY KEY (QSO_ID), |
| 415 | 415 | KEY QST_ID (QST_ID), |
| 416 | 416 | KEY QSO_order (QSO_order)"; |
| 417 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 418 | - $table_name = 'esp_registration'; |
|
| 419 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 417 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 418 | + $table_name = 'esp_registration'; |
|
| 419 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 420 | 420 | EVT_ID bigint(20) unsigned NOT NULL, |
| 421 | 421 | ATT_ID bigint(20) unsigned NOT NULL, |
| 422 | 422 | TXN_ID int(10) unsigned NOT NULL, |
@@ -440,18 +440,18 @@ discard block |
||
| 440 | 440 | KEY TKT_ID (TKT_ID), |
| 441 | 441 | KEY EVT_ID (EVT_ID), |
| 442 | 442 | KEY STS_ID (STS_ID)"; |
| 443 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 444 | - $table_name = 'esp_registration_payment'; |
|
| 445 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 443 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 444 | + $table_name = 'esp_registration_payment'; |
|
| 445 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 446 | 446 | REG_ID int(10) unsigned NOT NULL, |
| 447 | 447 | PAY_ID int(10) unsigned NULL, |
| 448 | 448 | RPY_amount decimal(12,3) NOT NULL DEFAULT '0.00', |
| 449 | 449 | PRIMARY KEY (RPY_ID), |
| 450 | 450 | KEY REG_ID (REG_ID), |
| 451 | 451 | KEY PAY_ID (PAY_ID)"; |
| 452 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 453 | - $table_name = 'esp_state'; |
|
| 454 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
| 452 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 453 | + $table_name = 'esp_state'; |
|
| 454 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
| 455 | 455 | CNT_ISO varchar(2) NOT NULL, |
| 456 | 456 | STA_abbrev varchar(24) NOT NULL, |
| 457 | 457 | STA_name varchar(100) NOT NULL, |
@@ -459,9 +459,9 @@ discard block |
||
| 459 | 459 | PRIMARY KEY (STA_ID), |
| 460 | 460 | KEY STA_abbrev (STA_abbrev), |
| 461 | 461 | KEY CNT_ISO (CNT_ISO)"; |
| 462 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 463 | - $table_name = 'esp_status'; |
|
| 464 | - $sql = "STS_ID varchar(3) NOT NULL, |
|
| 462 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 463 | + $table_name = 'esp_status'; |
|
| 464 | + $sql = "STS_ID varchar(3) NOT NULL, |
|
| 465 | 465 | STS_code varchar(45) NOT NULL, |
| 466 | 466 | STS_type varchar(45) NOT NULL, |
| 467 | 467 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -469,9 +469,9 @@ discard block |
||
| 469 | 469 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
| 470 | 470 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
| 471 | 471 | KEY STS_type (STS_type)"; |
| 472 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 473 | - $table_name = 'esp_transaction'; |
|
| 474 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 472 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 473 | + $table_name = 'esp_transaction'; |
|
| 474 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 475 | 475 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 476 | 476 | TXN_total decimal(12,3) DEFAULT '0.00', |
| 477 | 477 | TXN_paid decimal(12,3) NOT NULL DEFAULT '0.00', |
@@ -483,9 +483,9 @@ discard block |
||
| 483 | 483 | PRIMARY KEY (TXN_ID), |
| 484 | 484 | KEY TXN_timestamp (TXN_timestamp), |
| 485 | 485 | KEY STS_ID (STS_ID)"; |
| 486 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 487 | - $table_name = 'esp_venue_meta'; |
|
| 488 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 486 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 487 | + $table_name = 'esp_venue_meta'; |
|
| 488 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 489 | 489 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
| 490 | 490 | VNU_address varchar(255) DEFAULT NULL, |
| 491 | 491 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -504,10 +504,10 @@ discard block |
||
| 504 | 504 | KEY VNU_ID (VNU_ID), |
| 505 | 505 | KEY STA_ID (STA_ID), |
| 506 | 506 | KEY CNT_ISO (CNT_ISO)"; |
| 507 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 508 | - // modified tables |
|
| 509 | - $table_name = "esp_price"; |
|
| 510 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 507 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 508 | + // modified tables |
|
| 509 | + $table_name = "esp_price"; |
|
| 510 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 511 | 511 | PRT_ID tinyint(3) unsigned NOT NULL, |
| 512 | 512 | PRC_amount decimal(12,3) NOT NULL DEFAULT '0.00', |
| 513 | 513 | PRC_name varchar(245) NOT NULL, |
@@ -520,9 +520,9 @@ discard block |
||
| 520 | 520 | PRC_parent int(10) unsigned DEFAULT 0, |
| 521 | 521 | PRIMARY KEY (PRC_ID), |
| 522 | 522 | KEY PRT_ID (PRT_ID)"; |
| 523 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 524 | - $table_name = "esp_price_type"; |
|
| 525 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
| 523 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 524 | + $table_name = "esp_price_type"; |
|
| 525 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
| 526 | 526 | PRT_name varchar(45) NOT NULL, |
| 527 | 527 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
| 528 | 528 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -531,9 +531,9 @@ discard block |
||
| 531 | 531 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
| 532 | 532 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
| 533 | 533 | PRIMARY KEY (PRT_ID)"; |
| 534 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 535 | - $table_name = "esp_ticket"; |
|
| 536 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 534 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 535 | + $table_name = "esp_ticket"; |
|
| 536 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 537 | 537 | TTM_ID int(10) unsigned NOT NULL, |
| 538 | 538 | TKT_name varchar(245) NOT NULL DEFAULT '', |
| 539 | 539 | TKT_description text NOT NULL, |
@@ -556,9 +556,9 @@ discard block |
||
| 556 | 556 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
| 557 | 557 | PRIMARY KEY (TKT_ID), |
| 558 | 558 | KEY TKT_start_date (TKT_start_date)"; |
| 559 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 560 | - $table_name = 'esp_question_group'; |
|
| 561 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 559 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 560 | + $table_name = 'esp_question_group'; |
|
| 561 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 562 | 562 | QSG_name varchar(255) NOT NULL, |
| 563 | 563 | QSG_identifier varchar(100) NOT NULL, |
| 564 | 564 | QSG_desc text NULL, |
@@ -571,70 +571,70 @@ discard block |
||
| 571 | 571 | PRIMARY KEY (QSG_ID), |
| 572 | 572 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
| 573 | 573 | KEY QSG_order (QSG_order)'; |
| 574 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 575 | - $this->insert_default_data(); |
|
| 576 | - return true; |
|
| 577 | - } |
|
| 574 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 575 | + $this->insert_default_data(); |
|
| 576 | + return true; |
|
| 577 | + } |
|
| 578 | 578 | |
| 579 | - /** |
|
| 580 | - * Inserts default data on new installs |
|
| 581 | - * @since 4.10.0.p |
|
| 582 | - * @throws EE_Error |
|
| 583 | - * @throws InvalidArgumentException |
|
| 584 | - * @throws ReflectionException |
|
| 585 | - * @throws InvalidDataTypeException |
|
| 586 | - * @throws InvalidInterfaceException |
|
| 587 | - */ |
|
| 588 | - public function insert_default_data() |
|
| 589 | - { |
|
| 590 | - $this->previous_dms->insert_default_data(); |
|
| 591 | - $this->removeMijirehPM(); |
|
| 592 | - } |
|
| 579 | + /** |
|
| 580 | + * Inserts default data on new installs |
|
| 581 | + * @since 4.10.0.p |
|
| 582 | + * @throws EE_Error |
|
| 583 | + * @throws InvalidArgumentException |
|
| 584 | + * @throws ReflectionException |
|
| 585 | + * @throws InvalidDataTypeException |
|
| 586 | + * @throws InvalidInterfaceException |
|
| 587 | + */ |
|
| 588 | + public function insert_default_data() |
|
| 589 | + { |
|
| 590 | + $this->previous_dms->insert_default_data(); |
|
| 591 | + $this->removeMijirehPM(); |
|
| 592 | + } |
|
| 593 | 593 | |
| 594 | 594 | |
| 595 | 595 | |
| 596 | - /** |
|
| 597 | - * @return boolean |
|
| 598 | - */ |
|
| 599 | - public function schema_changes_after_migration() |
|
| 600 | - { |
|
| 601 | - return true; |
|
| 602 | - } |
|
| 596 | + /** |
|
| 597 | + * @return boolean |
|
| 598 | + */ |
|
| 599 | + public function schema_changes_after_migration() |
|
| 600 | + { |
|
| 601 | + return true; |
|
| 602 | + } |
|
| 603 | 603 | |
| 604 | 604 | |
| 605 | 605 | |
| 606 | - public function migration_page_hooks() |
|
| 607 | - { |
|
| 608 | - } |
|
| 606 | + public function migration_page_hooks() |
|
| 607 | + { |
|
| 608 | + } |
|
| 609 | 609 | |
| 610 | - /** |
|
| 611 | - * Mijireh was removed in 4.10.3.p, but let's avoid having an error message because its files were removed, and don't |
|
| 612 | - * show old payments made with it as being by "Unknown". The fix is to make it an "Admin_Only" payment method |
|
| 613 | - * (like Invoice or Check) but don't allow it to be used in the admin either... so it's usable nowhere from now on, |
|
| 614 | - * but it still exists so there's no problems. |
|
| 615 | - * @since 4.10.3.p |
|
| 616 | - */ |
|
| 617 | - protected function removeMijirehPM() |
|
| 618 | - { |
|
| 619 | - global $wpdb; |
|
| 620 | - $wpdb->update( |
|
| 621 | - $wpdb->prefix . 'esp_payment_method', |
|
| 622 | - [ |
|
| 623 | - 'PMD_type' => 'Admin_Only', |
|
| 624 | - 'PMD_scope' => serialize(array()) |
|
| 625 | - ], |
|
| 626 | - [ |
|
| 627 | - 'PMD_type' => 'Mijireh' |
|
| 628 | - ], |
|
| 629 | - [ |
|
| 630 | - // update formats |
|
| 631 | - '%s', // PMD_type |
|
| 632 | - '%s', // PMD_scope |
|
| 633 | - ], |
|
| 634 | - [ |
|
| 635 | - // where formats |
|
| 636 | - '%s' |
|
| 637 | - ] |
|
| 638 | - ); |
|
| 639 | - } |
|
| 610 | + /** |
|
| 611 | + * Mijireh was removed in 4.10.3.p, but let's avoid having an error message because its files were removed, and don't |
|
| 612 | + * show old payments made with it as being by "Unknown". The fix is to make it an "Admin_Only" payment method |
|
| 613 | + * (like Invoice or Check) but don't allow it to be used in the admin either... so it's usable nowhere from now on, |
|
| 614 | + * but it still exists so there's no problems. |
|
| 615 | + * @since 4.10.3.p |
|
| 616 | + */ |
|
| 617 | + protected function removeMijirehPM() |
|
| 618 | + { |
|
| 619 | + global $wpdb; |
|
| 620 | + $wpdb->update( |
|
| 621 | + $wpdb->prefix . 'esp_payment_method', |
|
| 622 | + [ |
|
| 623 | + 'PMD_type' => 'Admin_Only', |
|
| 624 | + 'PMD_scope' => serialize(array()) |
|
| 625 | + ], |
|
| 626 | + [ |
|
| 627 | + 'PMD_type' => 'Mijireh' |
|
| 628 | + ], |
|
| 629 | + [ |
|
| 630 | + // update formats |
|
| 631 | + '%s', // PMD_type |
|
| 632 | + '%s', // PMD_scope |
|
| 633 | + ], |
|
| 634 | + [ |
|
| 635 | + // where formats |
|
| 636 | + '%s' |
|
| 637 | + ] |
|
| 638 | + ); |
|
| 639 | + } |
|
| 640 | 640 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) { |
| 38 | 38 | add_action( |
| 39 | 39 | 'shutdown', |
| 40 | - static function () { |
|
| 40 | + static function() { |
|
| 41 | 41 | flush_rewrite_rules(); |
| 42 | 42 | update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false); |
| 43 | 43 | } |
@@ -12,35 +12,35 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class RewriteRules |
| 14 | 14 | { |
| 15 | - const OPTION_KEY_FLUSH_REWRITE_RULES = 'ee_flush_rewrite_rules'; |
|
| 15 | + const OPTION_KEY_FLUSH_REWRITE_RULES = 'ee_flush_rewrite_rules'; |
|
| 16 | 16 | |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * This will flush rewrite rules on demand. This actually gets called around wp init priority level 100. |
|
| 20 | - * |
|
| 21 | - * @return void |
|
| 22 | - */ |
|
| 23 | - public function flush() |
|
| 24 | - { |
|
| 25 | - update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true); |
|
| 26 | - } |
|
| 18 | + /** |
|
| 19 | + * This will flush rewrite rules on demand. This actually gets called around wp init priority level 100. |
|
| 20 | + * |
|
| 21 | + * @return void |
|
| 22 | + */ |
|
| 23 | + public function flush() |
|
| 24 | + { |
|
| 25 | + update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * This will flush rewrite rules on demand. This actually gets called around wp init priority level 100. |
|
| 31 | - * |
|
| 32 | - * @return void |
|
| 33 | - */ |
|
| 34 | - public function flushRewriteRules() |
|
| 35 | - { |
|
| 36 | - if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) { |
|
| 37 | - add_action( |
|
| 38 | - 'shutdown', |
|
| 39 | - static function () { |
|
| 40 | - flush_rewrite_rules(); |
|
| 41 | - update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false); |
|
| 42 | - } |
|
| 43 | - ); |
|
| 44 | - } |
|
| 45 | - } |
|
| 29 | + /** |
|
| 30 | + * This will flush rewrite rules on demand. This actually gets called around wp init priority level 100. |
|
| 31 | + * |
|
| 32 | + * @return void |
|
| 33 | + */ |
|
| 34 | + public function flushRewriteRules() |
|
| 35 | + { |
|
| 36 | + if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) { |
|
| 37 | + add_action( |
|
| 38 | + 'shutdown', |
|
| 39 | + static function () { |
|
| 40 | + flush_rewrite_rules(); |
|
| 41 | + update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false); |
|
| 42 | + } |
|
| 43 | + ); |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | 46 | } |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | */ |
| 69 | 69 | public function visit($model_objects_to_identify) |
| 70 | 70 | { |
| 71 | - if (! $this->isDiscovered()) { |
|
| 71 | + if ( ! $this->isDiscovered()) { |
|
| 72 | 72 | $this->discover(); |
| 73 | 73 | } |
| 74 | 74 | if ($this->isComplete()) { |
@@ -31,105 +31,105 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | abstract class BaseNode |
| 33 | 33 | { |
| 34 | - /** |
|
| 35 | - * @var boolean |
|
| 36 | - */ |
|
| 37 | - protected $complete; |
|
| 34 | + /** |
|
| 35 | + * @var boolean |
|
| 36 | + */ |
|
| 37 | + protected $complete; |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var array of model names we don't want to traverse |
|
| 42 | - */ |
|
| 43 | - protected $dont_traverse_models; |
|
| 40 | + /** |
|
| 41 | + * @var array of model names we don't want to traverse |
|
| 42 | + */ |
|
| 43 | + protected $dont_traverse_models; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Whether this item has already been initialized |
|
| 47 | - */ |
|
| 48 | - abstract protected function isDiscovered(); |
|
| 45 | + /** |
|
| 46 | + * Whether this item has already been initialized |
|
| 47 | + */ |
|
| 48 | + abstract protected function isDiscovered(); |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Determines if the work is done yet or not. Requires you to have first discovered what work exists by calling |
|
| 52 | - * discover(). |
|
| 53 | - * @since 4.10.12.p |
|
| 54 | - * @return boolean |
|
| 55 | - */ |
|
| 56 | - abstract public function isComplete(); |
|
| 50 | + /** |
|
| 51 | + * Determines if the work is done yet or not. Requires you to have first discovered what work exists by calling |
|
| 52 | + * discover(). |
|
| 53 | + * @since 4.10.12.p |
|
| 54 | + * @return boolean |
|
| 55 | + */ |
|
| 56 | + abstract public function isComplete(); |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * Discovers what work needs to be done to complete traversing this node and its children. |
|
| 60 | - * Note that this is separate from the constructor, so we can create child nodes without |
|
| 61 | - * discovering them immediately. |
|
| 62 | - * @since 4.10.12.p |
|
| 63 | - * @return mixed |
|
| 64 | - */ |
|
| 65 | - abstract protected function discover(); |
|
| 58 | + /** |
|
| 59 | + * Discovers what work needs to be done to complete traversing this node and its children. |
|
| 60 | + * Note that this is separate from the constructor, so we can create child nodes without |
|
| 61 | + * discovering them immediately. |
|
| 62 | + * @since 4.10.12.p |
|
| 63 | + * @return mixed |
|
| 64 | + */ |
|
| 65 | + abstract protected function discover(); |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Identifies model objects, up to the limit $model_objects_to_identify. |
|
| 69 | - * @since 4.10.12.p |
|
| 70 | - * @param int $model_objects_to_identify |
|
| 71 | - * @return int units of work done |
|
| 72 | - */ |
|
| 73 | - abstract protected function work($model_objects_to_identify); |
|
| 67 | + /** |
|
| 68 | + * Identifies model objects, up to the limit $model_objects_to_identify. |
|
| 69 | + * @since 4.10.12.p |
|
| 70 | + * @param int $model_objects_to_identify |
|
| 71 | + * @return int units of work done |
|
| 72 | + */ |
|
| 73 | + abstract protected function work($model_objects_to_identify); |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Shows the entity/relation node as an array. |
|
| 77 | - * @since 4.10.12.p |
|
| 78 | - * @return array |
|
| 79 | - */ |
|
| 80 | - abstract public function toArray(); |
|
| 75 | + /** |
|
| 76 | + * Shows the entity/relation node as an array. |
|
| 77 | + * @since 4.10.12.p |
|
| 78 | + * @return array |
|
| 79 | + */ |
|
| 80 | + abstract public function toArray(); |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Discovers how much work there is to do, double-checks the work isn't already finished, and then does the work. |
|
| 84 | - * Note: do not call when site is in maintenance mode level 2. |
|
| 85 | - * |
|
| 86 | - * @since 4.10.12.p |
|
| 87 | - * @param $model_objects_to_identify |
|
| 88 | - * @return int number of model objects we want to identify during this call. On subsequent calls we'll continue |
|
| 89 | - * where we left off. |
|
| 90 | - */ |
|
| 91 | - public function visit($model_objects_to_identify) |
|
| 92 | - { |
|
| 93 | - if (! $this->isDiscovered()) { |
|
| 94 | - $this->discover(); |
|
| 95 | - } |
|
| 96 | - if ($this->isComplete()) { |
|
| 97 | - return 0; |
|
| 98 | - } |
|
| 99 | - return $this->work($model_objects_to_identify); |
|
| 100 | - } |
|
| 82 | + /** |
|
| 83 | + * Discovers how much work there is to do, double-checks the work isn't already finished, and then does the work. |
|
| 84 | + * Note: do not call when site is in maintenance mode level 2. |
|
| 85 | + * |
|
| 86 | + * @since 4.10.12.p |
|
| 87 | + * @param $model_objects_to_identify |
|
| 88 | + * @return int number of model objects we want to identify during this call. On subsequent calls we'll continue |
|
| 89 | + * where we left off. |
|
| 90 | + */ |
|
| 91 | + public function visit($model_objects_to_identify) |
|
| 92 | + { |
|
| 93 | + if (! $this->isDiscovered()) { |
|
| 94 | + $this->discover(); |
|
| 95 | + } |
|
| 96 | + if ($this->isComplete()) { |
|
| 97 | + return 0; |
|
| 98 | + } |
|
| 99 | + return $this->work($model_objects_to_identify); |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * Gets the IDs of completely identified model objects that can be deleted. |
|
| 104 | - * @since 4.10.12.p |
|
| 105 | - * @return mixed |
|
| 106 | - */ |
|
| 107 | - abstract public function getIds(); |
|
| 102 | + /** |
|
| 103 | + * Gets the IDs of completely identified model objects that can be deleted. |
|
| 104 | + * @since 4.10.12.p |
|
| 105 | + * @return mixed |
|
| 106 | + */ |
|
| 107 | + abstract public function getIds(); |
|
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * Make sure we encode whether its complete or not, but don't use such a long name. |
|
| 111 | - * @since 4.10.12.p |
|
| 112 | - * @return array |
|
| 113 | - */ |
|
| 114 | - public function __sleep() |
|
| 115 | - { |
|
| 116 | - $this->c = $this->complete; |
|
| 117 | - $this->dtm = $this->dont_traverse_models; |
|
| 118 | - return [ |
|
| 119 | - 'c', |
|
| 120 | - 'dtm' |
|
| 121 | - ]; |
|
| 122 | - } |
|
| 109 | + /** |
|
| 110 | + * Make sure we encode whether its complete or not, but don't use such a long name. |
|
| 111 | + * @since 4.10.12.p |
|
| 112 | + * @return array |
|
| 113 | + */ |
|
| 114 | + public function __sleep() |
|
| 115 | + { |
|
| 116 | + $this->c = $this->complete; |
|
| 117 | + $this->dtm = $this->dont_traverse_models; |
|
| 118 | + return [ |
|
| 119 | + 'c', |
|
| 120 | + 'dtm' |
|
| 121 | + ]; |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - /** |
|
| 125 | - * Use the dynamic property to set the "complete" property. |
|
| 126 | - * @since 4.10.12.p |
|
| 127 | - */ |
|
| 128 | - public function __wakeup() |
|
| 129 | - { |
|
| 130 | - $this->complete = $this->c; |
|
| 131 | - $this->dont_traverse_models = $this->dtm; |
|
| 132 | - } |
|
| 124 | + /** |
|
| 125 | + * Use the dynamic property to set the "complete" property. |
|
| 126 | + * @since 4.10.12.p |
|
| 127 | + */ |
|
| 128 | + public function __wakeup() |
|
| 129 | + { |
|
| 130 | + $this->complete = $this->c; |
|
| 131 | + $this->dont_traverse_models = $this->dtm; |
|
| 132 | + } |
|
| 133 | 133 | } |
| 134 | 134 | // End of file BaseNode.php |
| 135 | 135 | // Location: EventEspresso\core\services\orm\tree_traversal/BaseNode.php |
@@ -419,7 +419,7 @@ |
||
| 419 | 419 | { |
| 420 | 420 | return ! $this->is_percent() |
| 421 | 421 | ? $this->get_pretty('PRC_amount') |
| 422 | - : $this->get('PRC_amount') . '%'; |
|
| 422 | + : $this->get('PRC_amount').'%'; |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | |
@@ -12,446 +12,446 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class EE_Price extends EE_Soft_Delete_Base_Class |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * @param array $props_n_values incoming values |
|
| 17 | - * @param string $timezone incoming timezone (if not set the timezone set for the website will be |
|
| 18 | - * used.) |
|
| 19 | - * @param array $date_formats incoming date_formats in an array where the first value is the |
|
| 20 | - * date_format and the second value is the time format |
|
| 21 | - * @return EE_Price |
|
| 22 | - * @throws EE_Error |
|
| 23 | - * @throws InvalidArgumentException |
|
| 24 | - * @throws ReflectionException |
|
| 25 | - * @throws InvalidDataTypeException |
|
| 26 | - * @throws InvalidInterfaceException |
|
| 27 | - */ |
|
| 28 | - public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) |
|
| 29 | - { |
|
| 30 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
| 31 | - return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @param array $props_n_values incoming values from the database |
|
| 37 | - * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
|
| 38 | - * the website will be used. |
|
| 39 | - * @return EE_Price |
|
| 40 | - * @throws EE_Error |
|
| 41 | - * @throws InvalidArgumentException |
|
| 42 | - * @throws ReflectionException |
|
| 43 | - * @throws InvalidDataTypeException |
|
| 44 | - * @throws InvalidInterfaceException |
|
| 45 | - */ |
|
| 46 | - public static function new_instance_from_db($props_n_values = array(), $timezone = null) |
|
| 47 | - { |
|
| 48 | - return new self($props_n_values, true, $timezone); |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * Set Price type ID |
|
| 54 | - * |
|
| 55 | - * @param int $PRT_ID |
|
| 56 | - * @throws EE_Error |
|
| 57 | - * @throws InvalidArgumentException |
|
| 58 | - * @throws ReflectionException |
|
| 59 | - * @throws InvalidDataTypeException |
|
| 60 | - * @throws InvalidInterfaceException |
|
| 61 | - */ |
|
| 62 | - public function set_type($PRT_ID = 0) |
|
| 63 | - { |
|
| 64 | - $this->set('PRT_ID', $PRT_ID); |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * Set Price Amount |
|
| 70 | - * |
|
| 71 | - * @param float $PRC_amount |
|
| 72 | - * @throws EE_Error |
|
| 73 | - * @throws InvalidArgumentException |
|
| 74 | - * @throws ReflectionException |
|
| 75 | - * @throws InvalidDataTypeException |
|
| 76 | - * @throws InvalidInterfaceException |
|
| 77 | - */ |
|
| 78 | - public function set_amount($PRC_amount = 0.00) |
|
| 79 | - { |
|
| 80 | - $this->set('PRC_amount', $PRC_amount); |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * Set Price Name |
|
| 86 | - * |
|
| 87 | - * @param string $PRC_name |
|
| 88 | - * @throws EE_Error |
|
| 89 | - * @throws InvalidArgumentException |
|
| 90 | - * @throws ReflectionException |
|
| 91 | - * @throws InvalidDataTypeException |
|
| 92 | - * @throws InvalidInterfaceException |
|
| 93 | - */ |
|
| 94 | - public function set_name($PRC_name = '') |
|
| 95 | - { |
|
| 96 | - $this->set('PRC_name', $PRC_name); |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * Set Price Description |
|
| 102 | - * |
|
| 103 | - * @param string $PRC_desc |
|
| 104 | - * @throws EE_Error |
|
| 105 | - * @throws InvalidArgumentException |
|
| 106 | - * @throws ReflectionException |
|
| 107 | - * @throws InvalidDataTypeException |
|
| 108 | - * @throws InvalidInterfaceException |
|
| 109 | - */ |
|
| 110 | - public function set_description($PRC_desc = '') |
|
| 111 | - { |
|
| 112 | - $this->Set('PRC_desc', $PRC_desc); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * set is_default |
|
| 118 | - * |
|
| 119 | - * @param bool $PRC_is_default |
|
| 120 | - * @throws EE_Error |
|
| 121 | - * @throws InvalidArgumentException |
|
| 122 | - * @throws ReflectionException |
|
| 123 | - * @throws InvalidDataTypeException |
|
| 124 | - * @throws InvalidInterfaceException |
|
| 125 | - */ |
|
| 126 | - public function set_is_default($PRC_is_default = false) |
|
| 127 | - { |
|
| 128 | - $this->set('PRC_is_default', $PRC_is_default); |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * set deleted |
|
| 134 | - * |
|
| 135 | - * @param bool $PRC_deleted |
|
| 136 | - * @throws EE_Error |
|
| 137 | - * @throws InvalidArgumentException |
|
| 138 | - * @throws ReflectionException |
|
| 139 | - * @throws InvalidDataTypeException |
|
| 140 | - * @throws InvalidInterfaceException |
|
| 141 | - */ |
|
| 142 | - public function set_deleted($PRC_deleted = null) |
|
| 143 | - { |
|
| 144 | - $this->set('PRC_deleted', $PRC_deleted); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * get Price type |
|
| 150 | - * |
|
| 151 | - * @return int |
|
| 152 | - * @throws EE_Error |
|
| 153 | - * @throws InvalidArgumentException |
|
| 154 | - * @throws ReflectionException |
|
| 155 | - * @throws InvalidDataTypeException |
|
| 156 | - * @throws InvalidInterfaceException |
|
| 157 | - */ |
|
| 158 | - public function type() |
|
| 159 | - { |
|
| 160 | - return $this->get('PRT_ID'); |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * get Price Amount |
|
| 166 | - * |
|
| 167 | - * @return float |
|
| 168 | - * @throws EE_Error |
|
| 169 | - * @throws InvalidArgumentException |
|
| 170 | - * @throws ReflectionException |
|
| 171 | - * @throws InvalidDataTypeException |
|
| 172 | - * @throws InvalidInterfaceException |
|
| 173 | - */ |
|
| 174 | - public function amount() |
|
| 175 | - { |
|
| 176 | - return $this->get('PRC_amount'); |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - |
|
| 180 | - /** |
|
| 181 | - * get Price Name |
|
| 182 | - * |
|
| 183 | - * @return string |
|
| 184 | - * @throws EE_Error |
|
| 185 | - * @throws InvalidArgumentException |
|
| 186 | - * @throws ReflectionException |
|
| 187 | - * @throws InvalidDataTypeException |
|
| 188 | - * @throws InvalidInterfaceException |
|
| 189 | - */ |
|
| 190 | - public function name() |
|
| 191 | - { |
|
| 192 | - return $this->get('PRC_name'); |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * get Price description |
|
| 198 | - * |
|
| 199 | - * @return string |
|
| 200 | - * @throws EE_Error |
|
| 201 | - * @throws InvalidArgumentException |
|
| 202 | - * @throws ReflectionException |
|
| 203 | - * @throws InvalidDataTypeException |
|
| 204 | - * @throws InvalidInterfaceException |
|
| 205 | - */ |
|
| 206 | - public function desc() |
|
| 207 | - { |
|
| 208 | - return $this->get('PRC_desc'); |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * get overrides |
|
| 214 | - * |
|
| 215 | - * @return int |
|
| 216 | - * @throws EE_Error |
|
| 217 | - * @throws InvalidArgumentException |
|
| 218 | - * @throws ReflectionException |
|
| 219 | - * @throws InvalidDataTypeException |
|
| 220 | - * @throws InvalidInterfaceException |
|
| 221 | - */ |
|
| 222 | - public function overrides() |
|
| 223 | - { |
|
| 224 | - return $this->get('PRC_overrides'); |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - |
|
| 228 | - /** |
|
| 229 | - * get order |
|
| 230 | - * |
|
| 231 | - * @return int |
|
| 232 | - * @throws EE_Error |
|
| 233 | - * @throws InvalidArgumentException |
|
| 234 | - * @throws ReflectionException |
|
| 235 | - * @throws InvalidDataTypeException |
|
| 236 | - * @throws InvalidInterfaceException |
|
| 237 | - */ |
|
| 238 | - public function order() |
|
| 239 | - { |
|
| 240 | - return $this->get('PRC_order'); |
|
| 241 | - } |
|
| 242 | - |
|
| 243 | - |
|
| 244 | - /** |
|
| 245 | - * get the author of the price |
|
| 246 | - * |
|
| 247 | - * @return int |
|
| 248 | - * @throws EE_Error |
|
| 249 | - * @throws InvalidArgumentException |
|
| 250 | - * @throws ReflectionException |
|
| 251 | - * @throws InvalidDataTypeException |
|
| 252 | - * @throws InvalidInterfaceException |
|
| 253 | - * @since 4.5.0 |
|
| 254 | - */ |
|
| 255 | - public function wp_user() |
|
| 256 | - { |
|
| 257 | - return $this->get('PRC_wp_user'); |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - |
|
| 261 | - /** |
|
| 262 | - * get is_default |
|
| 263 | - * |
|
| 264 | - * @return bool |
|
| 265 | - * @throws EE_Error |
|
| 266 | - * @throws InvalidArgumentException |
|
| 267 | - * @throws ReflectionException |
|
| 268 | - * @throws InvalidDataTypeException |
|
| 269 | - * @throws InvalidInterfaceException |
|
| 270 | - */ |
|
| 271 | - public function is_default() |
|
| 272 | - { |
|
| 273 | - return $this->get('PRC_is_default'); |
|
| 274 | - } |
|
| 275 | - |
|
| 276 | - |
|
| 277 | - /** |
|
| 278 | - * get deleted |
|
| 279 | - * |
|
| 280 | - * @return bool |
|
| 281 | - * @throws EE_Error |
|
| 282 | - * @throws InvalidArgumentException |
|
| 283 | - * @throws ReflectionException |
|
| 284 | - * @throws InvalidDataTypeException |
|
| 285 | - * @throws InvalidInterfaceException |
|
| 286 | - */ |
|
| 287 | - public function deleted() |
|
| 288 | - { |
|
| 289 | - return $this->get('PRC_deleted'); |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - |
|
| 293 | - /** |
|
| 294 | - * @return bool |
|
| 295 | - * @throws EE_Error |
|
| 296 | - * @throws InvalidArgumentException |
|
| 297 | - * @throws ReflectionException |
|
| 298 | - * @throws InvalidDataTypeException |
|
| 299 | - * @throws InvalidInterfaceException |
|
| 300 | - */ |
|
| 301 | - public function parent() |
|
| 302 | - { |
|
| 303 | - return $this->get('PRC_parent'); |
|
| 304 | - } |
|
| 305 | - |
|
| 306 | - |
|
| 307 | - // some helper methods for getting info on the price_type for this price |
|
| 308 | - |
|
| 309 | - |
|
| 310 | - /** |
|
| 311 | - * return whether the price is a base price or not |
|
| 312 | - * |
|
| 313 | - * @return boolean |
|
| 314 | - * @throws EE_Error |
|
| 315 | - * @throws InvalidArgumentException |
|
| 316 | - * @throws InvalidDataTypeException |
|
| 317 | - * @throws InvalidInterfaceException |
|
| 318 | - * @throws ReflectionException |
|
| 319 | - */ |
|
| 320 | - public function is_base_price() |
|
| 321 | - { |
|
| 322 | - $price_type = $this->type_obj(); |
|
| 323 | - return $price_type->is_base_price(); |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - |
|
| 327 | - /** |
|
| 328 | - * @return EE_Base_Class|EE_Price_Type |
|
| 329 | - * @throws EE_Error |
|
| 330 | - * @throws InvalidArgumentException |
|
| 331 | - * @throws ReflectionException |
|
| 332 | - * @throws InvalidDataTypeException |
|
| 333 | - * @throws InvalidInterfaceException |
|
| 334 | - */ |
|
| 335 | - public function type_obj() |
|
| 336 | - { |
|
| 337 | - return $this->get_first_related('Price_Type'); |
|
| 338 | - } |
|
| 339 | - |
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * @return int |
|
| 343 | - * @throws EE_Error |
|
| 344 | - * @throws InvalidArgumentException |
|
| 345 | - * @throws ReflectionException |
|
| 346 | - * @throws InvalidDataTypeException |
|
| 347 | - * @throws InvalidInterfaceException |
|
| 348 | - */ |
|
| 349 | - public function type_order() |
|
| 350 | - { |
|
| 351 | - return $this->get_first_related('Price_Type')->order(); |
|
| 352 | - } |
|
| 353 | - |
|
| 354 | - |
|
| 355 | - /** |
|
| 356 | - * Simply indicates whether this price increases or decreases the total |
|
| 357 | - * |
|
| 358 | - * @return boolean true = discount, otherwise adds to the total |
|
| 359 | - * @throws EE_Error |
|
| 360 | - * @throws InvalidArgumentException |
|
| 361 | - * @throws ReflectionException |
|
| 362 | - * @throws InvalidDataTypeException |
|
| 363 | - * @throws InvalidInterfaceException |
|
| 364 | - */ |
|
| 365 | - public function is_discount() |
|
| 366 | - { |
|
| 367 | - $price_type = $this->type_obj(); |
|
| 368 | - return $price_type->is_discount(); |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - |
|
| 372 | - /** |
|
| 373 | - * whether the price is a percentage or not |
|
| 374 | - * |
|
| 375 | - * @return boolean |
|
| 376 | - * @throws EE_Error |
|
| 377 | - * @throws InvalidArgumentException |
|
| 378 | - * @throws InvalidDataTypeException |
|
| 379 | - * @throws InvalidInterfaceException |
|
| 380 | - * @throws ReflectionException |
|
| 381 | - */ |
|
| 382 | - public function is_percent() |
|
| 383 | - { |
|
| 384 | - $price_type = $this->type_obj(); |
|
| 385 | - return $price_type->is_percent(); |
|
| 386 | - } |
|
| 387 | - |
|
| 388 | - |
|
| 389 | - /** |
|
| 390 | - * whether the price is a percentage or not |
|
| 391 | - * |
|
| 392 | - * @return boolean |
|
| 393 | - * @throws EE_Error |
|
| 394 | - * @throws InvalidArgumentException |
|
| 395 | - * @throws ReflectionException |
|
| 396 | - * @throws InvalidDataTypeException |
|
| 397 | - * @throws InvalidInterfaceException |
|
| 398 | - */ |
|
| 399 | - public function is_surcharge() |
|
| 400 | - { |
|
| 401 | - $price_type = $this->type_obj(); |
|
| 402 | - return $price_type->is_surcharge(); |
|
| 403 | - } |
|
| 404 | - |
|
| 405 | - /** |
|
| 406 | - * whether the price is a percentage or not |
|
| 407 | - * |
|
| 408 | - * @return boolean |
|
| 409 | - * @throws EE_Error |
|
| 410 | - * @throws InvalidArgumentException |
|
| 411 | - * @throws ReflectionException |
|
| 412 | - * @throws InvalidDataTypeException |
|
| 413 | - * @throws InvalidInterfaceException |
|
| 414 | - */ |
|
| 415 | - public function is_tax() |
|
| 416 | - { |
|
| 417 | - $price_type = $this->type_obj(); |
|
| 418 | - return $price_type->is_tax(); |
|
| 419 | - } |
|
| 420 | - |
|
| 421 | - |
|
| 422 | - /** |
|
| 423 | - * return pretty price dependant on whether its a dollar or percent. |
|
| 424 | - * |
|
| 425 | - * @return string |
|
| 426 | - * @throws EE_Error |
|
| 427 | - * @throws InvalidArgumentException |
|
| 428 | - * @throws ReflectionException |
|
| 429 | - * @throws InvalidDataTypeException |
|
| 430 | - * @throws InvalidInterfaceException |
|
| 431 | - * @since 4.4.0 |
|
| 432 | - */ |
|
| 433 | - public function pretty_price() |
|
| 434 | - { |
|
| 435 | - return ! $this->is_percent() |
|
| 436 | - ? $this->get_pretty('PRC_amount') |
|
| 437 | - : $this->get('PRC_amount') . '%'; |
|
| 438 | - } |
|
| 439 | - |
|
| 440 | - |
|
| 441 | - /** |
|
| 442 | - * @return mixed |
|
| 443 | - * @throws EE_Error |
|
| 444 | - * @throws InvalidArgumentException |
|
| 445 | - * @throws ReflectionException |
|
| 446 | - * @throws InvalidDataTypeException |
|
| 447 | - * @throws InvalidInterfaceException |
|
| 448 | - */ |
|
| 449 | - public function get_price_without_currency_symbol() |
|
| 450 | - { |
|
| 451 | - return str_replace( |
|
| 452 | - EE_Registry::instance()->CFG->currency->sign, |
|
| 453 | - '', |
|
| 454 | - $this->get_pretty('PRC_amount') |
|
| 455 | - ); |
|
| 456 | - } |
|
| 15 | + /** |
|
| 16 | + * @param array $props_n_values incoming values |
|
| 17 | + * @param string $timezone incoming timezone (if not set the timezone set for the website will be |
|
| 18 | + * used.) |
|
| 19 | + * @param array $date_formats incoming date_formats in an array where the first value is the |
|
| 20 | + * date_format and the second value is the time format |
|
| 21 | + * @return EE_Price |
|
| 22 | + * @throws EE_Error |
|
| 23 | + * @throws InvalidArgumentException |
|
| 24 | + * @throws ReflectionException |
|
| 25 | + * @throws InvalidDataTypeException |
|
| 26 | + * @throws InvalidInterfaceException |
|
| 27 | + */ |
|
| 28 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) |
|
| 29 | + { |
|
| 30 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
| 31 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @param array $props_n_values incoming values from the database |
|
| 37 | + * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
|
| 38 | + * the website will be used. |
|
| 39 | + * @return EE_Price |
|
| 40 | + * @throws EE_Error |
|
| 41 | + * @throws InvalidArgumentException |
|
| 42 | + * @throws ReflectionException |
|
| 43 | + * @throws InvalidDataTypeException |
|
| 44 | + * @throws InvalidInterfaceException |
|
| 45 | + */ |
|
| 46 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) |
|
| 47 | + { |
|
| 48 | + return new self($props_n_values, true, $timezone); |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * Set Price type ID |
|
| 54 | + * |
|
| 55 | + * @param int $PRT_ID |
|
| 56 | + * @throws EE_Error |
|
| 57 | + * @throws InvalidArgumentException |
|
| 58 | + * @throws ReflectionException |
|
| 59 | + * @throws InvalidDataTypeException |
|
| 60 | + * @throws InvalidInterfaceException |
|
| 61 | + */ |
|
| 62 | + public function set_type($PRT_ID = 0) |
|
| 63 | + { |
|
| 64 | + $this->set('PRT_ID', $PRT_ID); |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * Set Price Amount |
|
| 70 | + * |
|
| 71 | + * @param float $PRC_amount |
|
| 72 | + * @throws EE_Error |
|
| 73 | + * @throws InvalidArgumentException |
|
| 74 | + * @throws ReflectionException |
|
| 75 | + * @throws InvalidDataTypeException |
|
| 76 | + * @throws InvalidInterfaceException |
|
| 77 | + */ |
|
| 78 | + public function set_amount($PRC_amount = 0.00) |
|
| 79 | + { |
|
| 80 | + $this->set('PRC_amount', $PRC_amount); |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * Set Price Name |
|
| 86 | + * |
|
| 87 | + * @param string $PRC_name |
|
| 88 | + * @throws EE_Error |
|
| 89 | + * @throws InvalidArgumentException |
|
| 90 | + * @throws ReflectionException |
|
| 91 | + * @throws InvalidDataTypeException |
|
| 92 | + * @throws InvalidInterfaceException |
|
| 93 | + */ |
|
| 94 | + public function set_name($PRC_name = '') |
|
| 95 | + { |
|
| 96 | + $this->set('PRC_name', $PRC_name); |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * Set Price Description |
|
| 102 | + * |
|
| 103 | + * @param string $PRC_desc |
|
| 104 | + * @throws EE_Error |
|
| 105 | + * @throws InvalidArgumentException |
|
| 106 | + * @throws ReflectionException |
|
| 107 | + * @throws InvalidDataTypeException |
|
| 108 | + * @throws InvalidInterfaceException |
|
| 109 | + */ |
|
| 110 | + public function set_description($PRC_desc = '') |
|
| 111 | + { |
|
| 112 | + $this->Set('PRC_desc', $PRC_desc); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * set is_default |
|
| 118 | + * |
|
| 119 | + * @param bool $PRC_is_default |
|
| 120 | + * @throws EE_Error |
|
| 121 | + * @throws InvalidArgumentException |
|
| 122 | + * @throws ReflectionException |
|
| 123 | + * @throws InvalidDataTypeException |
|
| 124 | + * @throws InvalidInterfaceException |
|
| 125 | + */ |
|
| 126 | + public function set_is_default($PRC_is_default = false) |
|
| 127 | + { |
|
| 128 | + $this->set('PRC_is_default', $PRC_is_default); |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * set deleted |
|
| 134 | + * |
|
| 135 | + * @param bool $PRC_deleted |
|
| 136 | + * @throws EE_Error |
|
| 137 | + * @throws InvalidArgumentException |
|
| 138 | + * @throws ReflectionException |
|
| 139 | + * @throws InvalidDataTypeException |
|
| 140 | + * @throws InvalidInterfaceException |
|
| 141 | + */ |
|
| 142 | + public function set_deleted($PRC_deleted = null) |
|
| 143 | + { |
|
| 144 | + $this->set('PRC_deleted', $PRC_deleted); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * get Price type |
|
| 150 | + * |
|
| 151 | + * @return int |
|
| 152 | + * @throws EE_Error |
|
| 153 | + * @throws InvalidArgumentException |
|
| 154 | + * @throws ReflectionException |
|
| 155 | + * @throws InvalidDataTypeException |
|
| 156 | + * @throws InvalidInterfaceException |
|
| 157 | + */ |
|
| 158 | + public function type() |
|
| 159 | + { |
|
| 160 | + return $this->get('PRT_ID'); |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * get Price Amount |
|
| 166 | + * |
|
| 167 | + * @return float |
|
| 168 | + * @throws EE_Error |
|
| 169 | + * @throws InvalidArgumentException |
|
| 170 | + * @throws ReflectionException |
|
| 171 | + * @throws InvalidDataTypeException |
|
| 172 | + * @throws InvalidInterfaceException |
|
| 173 | + */ |
|
| 174 | + public function amount() |
|
| 175 | + { |
|
| 176 | + return $this->get('PRC_amount'); |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + |
|
| 180 | + /** |
|
| 181 | + * get Price Name |
|
| 182 | + * |
|
| 183 | + * @return string |
|
| 184 | + * @throws EE_Error |
|
| 185 | + * @throws InvalidArgumentException |
|
| 186 | + * @throws ReflectionException |
|
| 187 | + * @throws InvalidDataTypeException |
|
| 188 | + * @throws InvalidInterfaceException |
|
| 189 | + */ |
|
| 190 | + public function name() |
|
| 191 | + { |
|
| 192 | + return $this->get('PRC_name'); |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * get Price description |
|
| 198 | + * |
|
| 199 | + * @return string |
|
| 200 | + * @throws EE_Error |
|
| 201 | + * @throws InvalidArgumentException |
|
| 202 | + * @throws ReflectionException |
|
| 203 | + * @throws InvalidDataTypeException |
|
| 204 | + * @throws InvalidInterfaceException |
|
| 205 | + */ |
|
| 206 | + public function desc() |
|
| 207 | + { |
|
| 208 | + return $this->get('PRC_desc'); |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * get overrides |
|
| 214 | + * |
|
| 215 | + * @return int |
|
| 216 | + * @throws EE_Error |
|
| 217 | + * @throws InvalidArgumentException |
|
| 218 | + * @throws ReflectionException |
|
| 219 | + * @throws InvalidDataTypeException |
|
| 220 | + * @throws InvalidInterfaceException |
|
| 221 | + */ |
|
| 222 | + public function overrides() |
|
| 223 | + { |
|
| 224 | + return $this->get('PRC_overrides'); |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + |
|
| 228 | + /** |
|
| 229 | + * get order |
|
| 230 | + * |
|
| 231 | + * @return int |
|
| 232 | + * @throws EE_Error |
|
| 233 | + * @throws InvalidArgumentException |
|
| 234 | + * @throws ReflectionException |
|
| 235 | + * @throws InvalidDataTypeException |
|
| 236 | + * @throws InvalidInterfaceException |
|
| 237 | + */ |
|
| 238 | + public function order() |
|
| 239 | + { |
|
| 240 | + return $this->get('PRC_order'); |
|
| 241 | + } |
|
| 242 | + |
|
| 243 | + |
|
| 244 | + /** |
|
| 245 | + * get the author of the price |
|
| 246 | + * |
|
| 247 | + * @return int |
|
| 248 | + * @throws EE_Error |
|
| 249 | + * @throws InvalidArgumentException |
|
| 250 | + * @throws ReflectionException |
|
| 251 | + * @throws InvalidDataTypeException |
|
| 252 | + * @throws InvalidInterfaceException |
|
| 253 | + * @since 4.5.0 |
|
| 254 | + */ |
|
| 255 | + public function wp_user() |
|
| 256 | + { |
|
| 257 | + return $this->get('PRC_wp_user'); |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + |
|
| 261 | + /** |
|
| 262 | + * get is_default |
|
| 263 | + * |
|
| 264 | + * @return bool |
|
| 265 | + * @throws EE_Error |
|
| 266 | + * @throws InvalidArgumentException |
|
| 267 | + * @throws ReflectionException |
|
| 268 | + * @throws InvalidDataTypeException |
|
| 269 | + * @throws InvalidInterfaceException |
|
| 270 | + */ |
|
| 271 | + public function is_default() |
|
| 272 | + { |
|
| 273 | + return $this->get('PRC_is_default'); |
|
| 274 | + } |
|
| 275 | + |
|
| 276 | + |
|
| 277 | + /** |
|
| 278 | + * get deleted |
|
| 279 | + * |
|
| 280 | + * @return bool |
|
| 281 | + * @throws EE_Error |
|
| 282 | + * @throws InvalidArgumentException |
|
| 283 | + * @throws ReflectionException |
|
| 284 | + * @throws InvalidDataTypeException |
|
| 285 | + * @throws InvalidInterfaceException |
|
| 286 | + */ |
|
| 287 | + public function deleted() |
|
| 288 | + { |
|
| 289 | + return $this->get('PRC_deleted'); |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + |
|
| 293 | + /** |
|
| 294 | + * @return bool |
|
| 295 | + * @throws EE_Error |
|
| 296 | + * @throws InvalidArgumentException |
|
| 297 | + * @throws ReflectionException |
|
| 298 | + * @throws InvalidDataTypeException |
|
| 299 | + * @throws InvalidInterfaceException |
|
| 300 | + */ |
|
| 301 | + public function parent() |
|
| 302 | + { |
|
| 303 | + return $this->get('PRC_parent'); |
|
| 304 | + } |
|
| 305 | + |
|
| 306 | + |
|
| 307 | + // some helper methods for getting info on the price_type for this price |
|
| 308 | + |
|
| 309 | + |
|
| 310 | + /** |
|
| 311 | + * return whether the price is a base price or not |
|
| 312 | + * |
|
| 313 | + * @return boolean |
|
| 314 | + * @throws EE_Error |
|
| 315 | + * @throws InvalidArgumentException |
|
| 316 | + * @throws InvalidDataTypeException |
|
| 317 | + * @throws InvalidInterfaceException |
|
| 318 | + * @throws ReflectionException |
|
| 319 | + */ |
|
| 320 | + public function is_base_price() |
|
| 321 | + { |
|
| 322 | + $price_type = $this->type_obj(); |
|
| 323 | + return $price_type->is_base_price(); |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + |
|
| 327 | + /** |
|
| 328 | + * @return EE_Base_Class|EE_Price_Type |
|
| 329 | + * @throws EE_Error |
|
| 330 | + * @throws InvalidArgumentException |
|
| 331 | + * @throws ReflectionException |
|
| 332 | + * @throws InvalidDataTypeException |
|
| 333 | + * @throws InvalidInterfaceException |
|
| 334 | + */ |
|
| 335 | + public function type_obj() |
|
| 336 | + { |
|
| 337 | + return $this->get_first_related('Price_Type'); |
|
| 338 | + } |
|
| 339 | + |
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * @return int |
|
| 343 | + * @throws EE_Error |
|
| 344 | + * @throws InvalidArgumentException |
|
| 345 | + * @throws ReflectionException |
|
| 346 | + * @throws InvalidDataTypeException |
|
| 347 | + * @throws InvalidInterfaceException |
|
| 348 | + */ |
|
| 349 | + public function type_order() |
|
| 350 | + { |
|
| 351 | + return $this->get_first_related('Price_Type')->order(); |
|
| 352 | + } |
|
| 353 | + |
|
| 354 | + |
|
| 355 | + /** |
|
| 356 | + * Simply indicates whether this price increases or decreases the total |
|
| 357 | + * |
|
| 358 | + * @return boolean true = discount, otherwise adds to the total |
|
| 359 | + * @throws EE_Error |
|
| 360 | + * @throws InvalidArgumentException |
|
| 361 | + * @throws ReflectionException |
|
| 362 | + * @throws InvalidDataTypeException |
|
| 363 | + * @throws InvalidInterfaceException |
|
| 364 | + */ |
|
| 365 | + public function is_discount() |
|
| 366 | + { |
|
| 367 | + $price_type = $this->type_obj(); |
|
| 368 | + return $price_type->is_discount(); |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + |
|
| 372 | + /** |
|
| 373 | + * whether the price is a percentage or not |
|
| 374 | + * |
|
| 375 | + * @return boolean |
|
| 376 | + * @throws EE_Error |
|
| 377 | + * @throws InvalidArgumentException |
|
| 378 | + * @throws InvalidDataTypeException |
|
| 379 | + * @throws InvalidInterfaceException |
|
| 380 | + * @throws ReflectionException |
|
| 381 | + */ |
|
| 382 | + public function is_percent() |
|
| 383 | + { |
|
| 384 | + $price_type = $this->type_obj(); |
|
| 385 | + return $price_type->is_percent(); |
|
| 386 | + } |
|
| 387 | + |
|
| 388 | + |
|
| 389 | + /** |
|
| 390 | + * whether the price is a percentage or not |
|
| 391 | + * |
|
| 392 | + * @return boolean |
|
| 393 | + * @throws EE_Error |
|
| 394 | + * @throws InvalidArgumentException |
|
| 395 | + * @throws ReflectionException |
|
| 396 | + * @throws InvalidDataTypeException |
|
| 397 | + * @throws InvalidInterfaceException |
|
| 398 | + */ |
|
| 399 | + public function is_surcharge() |
|
| 400 | + { |
|
| 401 | + $price_type = $this->type_obj(); |
|
| 402 | + return $price_type->is_surcharge(); |
|
| 403 | + } |
|
| 404 | + |
|
| 405 | + /** |
|
| 406 | + * whether the price is a percentage or not |
|
| 407 | + * |
|
| 408 | + * @return boolean |
|
| 409 | + * @throws EE_Error |
|
| 410 | + * @throws InvalidArgumentException |
|
| 411 | + * @throws ReflectionException |
|
| 412 | + * @throws InvalidDataTypeException |
|
| 413 | + * @throws InvalidInterfaceException |
|
| 414 | + */ |
|
| 415 | + public function is_tax() |
|
| 416 | + { |
|
| 417 | + $price_type = $this->type_obj(); |
|
| 418 | + return $price_type->is_tax(); |
|
| 419 | + } |
|
| 420 | + |
|
| 421 | + |
|
| 422 | + /** |
|
| 423 | + * return pretty price dependant on whether its a dollar or percent. |
|
| 424 | + * |
|
| 425 | + * @return string |
|
| 426 | + * @throws EE_Error |
|
| 427 | + * @throws InvalidArgumentException |
|
| 428 | + * @throws ReflectionException |
|
| 429 | + * @throws InvalidDataTypeException |
|
| 430 | + * @throws InvalidInterfaceException |
|
| 431 | + * @since 4.4.0 |
|
| 432 | + */ |
|
| 433 | + public function pretty_price() |
|
| 434 | + { |
|
| 435 | + return ! $this->is_percent() |
|
| 436 | + ? $this->get_pretty('PRC_amount') |
|
| 437 | + : $this->get('PRC_amount') . '%'; |
|
| 438 | + } |
|
| 439 | + |
|
| 440 | + |
|
| 441 | + /** |
|
| 442 | + * @return mixed |
|
| 443 | + * @throws EE_Error |
|
| 444 | + * @throws InvalidArgumentException |
|
| 445 | + * @throws ReflectionException |
|
| 446 | + * @throws InvalidDataTypeException |
|
| 447 | + * @throws InvalidInterfaceException |
|
| 448 | + */ |
|
| 449 | + public function get_price_without_currency_symbol() |
|
| 450 | + { |
|
| 451 | + return str_replace( |
|
| 452 | + EE_Registry::instance()->CFG->currency->sign, |
|
| 453 | + '', |
|
| 454 | + $this->get_pretty('PRC_amount') |
|
| 455 | + ); |
|
| 456 | + } |
|
| 457 | 457 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct() |
| 22 | 22 | { |
| 23 | - $this->setName($this->namespace . 'DatetimesConnectionOrderbyEnum'); |
|
| 23 | + $this->setName($this->namespace.'DatetimesConnectionOrderbyEnum'); |
|
| 24 | 24 | $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
| 25 | 25 | parent::__construct(); |
| 26 | 26 | } |
@@ -14,31 +14,31 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class DatetimesConnectionOrderbyEnum extends EnumBase |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * DatetimesConnectionOrderbyEnum constructor. |
|
| 19 | - */ |
|
| 20 | - public function __construct() |
|
| 21 | - { |
|
| 22 | - $this->setName($this->namespace . 'DatetimesConnectionOrderbyEnum'); |
|
| 23 | - $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
|
| 24 | - parent::__construct(); |
|
| 25 | - } |
|
| 17 | + /** |
|
| 18 | + * DatetimesConnectionOrderbyEnum constructor. |
|
| 19 | + */ |
|
| 20 | + public function __construct() |
|
| 21 | + { |
|
| 22 | + $this->setName($this->namespace . 'DatetimesConnectionOrderbyEnum'); |
|
| 23 | + $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
|
| 24 | + parent::__construct(); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @return array |
|
| 30 | - */ |
|
| 31 | - protected function getValues(): array |
|
| 32 | - { |
|
| 33 | - return [ |
|
| 34 | - 'NAME' => [ |
|
| 35 | - 'value' => 'DTT_name', |
|
| 36 | - 'description' => esc_html__('Order by name', 'event_espresso'), |
|
| 37 | - ], |
|
| 38 | - 'START_DATE' => [ |
|
| 39 | - 'value' => 'DTT_EVT_start', |
|
| 40 | - 'description' => esc_html__('Order by start date', 'event_espresso'), |
|
| 41 | - ], |
|
| 42 | - ]; |
|
| 43 | - } |
|
| 28 | + /** |
|
| 29 | + * @return array |
|
| 30 | + */ |
|
| 31 | + protected function getValues(): array |
|
| 32 | + { |
|
| 33 | + return [ |
|
| 34 | + 'NAME' => [ |
|
| 35 | + 'value' => 'DTT_name', |
|
| 36 | + 'description' => esc_html__('Order by name', 'event_espresso'), |
|
| 37 | + ], |
|
| 38 | + 'START_DATE' => [ |
|
| 39 | + 'value' => 'DTT_EVT_start', |
|
| 40 | + 'description' => esc_html__('Order by start date', 'event_espresso'), |
|
| 41 | + ], |
|
| 42 | + ]; |
|
| 43 | + } |
|
| 44 | 44 | } |