Skip to content

Commit a7a2e03

Browse files
committed
working fieldset functionality
1 parent d63d580 commit a7a2e03

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+8648
-2069
lines changed

.cradle.php

+2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
require_once __DIR__ . '/src/Schema/events.php';
99
require_once __DIR__ . '/src/Relation/events.php';
1010
require_once __DIR__ . '/src/Model/events.php';
11+
require_once __DIR__ . '/src/Fieldset/events.php';
1112

1213
//bootstrap
1314
$this
1415
->preprocess(include __DIR__ . '/src/bootstrap/schema.php')
1516
->preprocess(include __DIR__ . '/src/bootstrap/helpers.php')
1617
->preprocess(include __DIR__ . '/src/bootstrap/template.php')
1718
->preprocess(include __DIR__ . '/src/bootstrap/files.php')
19+
->preprocess(include __DIR__ . '/src/bootstrap/fieldset.php')
1820
->preprocess(include __DIR__ . '/src/bootstrap/controller.php');

src/Exception.php

+59-3
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,29 @@
2020
*/
2121
class Exception extends BaseException
2222
{
23+
24+
/**
25+
* @const string ERROR_FIELDSET_NOT_FOUND Error template
26+
*/
27+
const ERROR_FIELDSET_NOT_FOUND = 'Could not find fieldset %s.';
28+
2329
/**
24-
* @const string ERROR_NO_MODEL Error template
30+
* @const string ERROR_FIELDSET_EXISTS
31+
*/
32+
const ERROR_FIELDSET_EXISTS = 'Unable to restore %s, fieldset already exists.';
33+
34+
/**
35+
* @const string ERROR_FIELDSET_ARCHIVE_EXISTS
36+
*/
37+
const ERROR_FIELDSET_ARCHIVE_EXISTS = 'Unable to archive %s, an archive of the fieldset already exists.';
38+
39+
/**
40+
* @const string ERROR_NO_SCHEMA Error template
2541
*/
2642
const ERROR_NO_SCHEMA = 'Schema is not loaded';
2743

2844
/**
29-
* @const string ERROR_CONFIG_NOT_FOUND Error template
45+
* @const string ERROR_SCHEMA_NOT_FOUND Error template
3046
*/
3147
const ERROR_SCHEMA_NOT_FOUND = 'Could not find schema %s.';
3248

@@ -45,6 +61,46 @@ class Exception extends BaseException
4561
*/
4662
const ERROR_SCHEMA_NO_RELATION = '%s has no relation to %s';
4763

64+
/**
65+
* Create a new exception for missing fieldset
66+
*
67+
* @param *string $name
68+
*
69+
* @return Exception
70+
*/
71+
public static function forFieldsetNotFound($name): Exception
72+
{
73+
$message = sprintf(static::ERROR_FIELDSET_NOT_FOUND, $name);
74+
return new static($message);
75+
}
76+
77+
/**
78+
* Create a new exception if fieldset already exists
79+
*
80+
* @param *string $name
81+
*
82+
* @return Exception
83+
*/
84+
public static function forFieldsetAlreadyExists(string $name)
85+
{
86+
$message = sprintf(static::ERROR_FIELDSET_EXISTS, $name);
87+
return new static($message);
88+
}
89+
90+
/**
91+
* Create a new exception if an archived of the
92+
* given fieldset already exists.
93+
*
94+
* @param *string $name
95+
*
96+
* @return Exception
97+
*/
98+
public static function forFieldsetArchiveExists(string $name)
99+
{
100+
$message = sprintf(static::ERROR_FIELDSET_ARCHIVE_EXISTS, $name);
101+
return new static($message);
102+
}
103+
48104
/**
49105
* Create a new exception for missing Schema
50106
*
@@ -66,7 +122,7 @@ public static function forNoSchema(): Exception
66122
}
67123

68124
/**
69-
* Create a new exception for missing config
125+
* Create a new exception for missing Schema
70126
*
71127
* @param *string $name
72128
*

0 commit comments

Comments
 (0)