You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/1. Setup.md
+3-1
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,9 @@ Use the [\PHPFUI\ORM\Migrator](http://phpfui.com/?n=PHPFUI\ORM&c=Migrator) class
58
58
## Generating Models
59
59
Once you have a compatible schema, or have modified a schema, you need to generate code. Use the [\PHPFUI\ORM\Tool\Generate\CRUD](http://phpfui.com/?n=PHPFUI%5CORM%5CTool%5CGenerate&c=CRUD) class to generate all or individual models. Check out the scripts folder for an example.
60
60
61
-
Once Record and Table models are generated, they will not be overwritten by the generation tools. Feel free to add methods by hand for your application needs.
61
+
Once **Record** and **Table** models are generated, they will not be overwritten by the generation tools. Feel free to add methods by hand for your application needs.
62
+
63
+
You should regenerate models when ever you update this library. Generation will only ever overwrite files in the **Definition** namespace, which should not be edited by hand. **Record**, **Table**, and **Validation** namespaces will only be generated if the file is missing.
62
64
63
65
## Validation
64
66
You can also generate initial validators with the [\PHPFUI\ORM\Tool\Generate\Validator](http://phpfui.com/?n=PHPFUI%5CORM%5CTool%5CGenerate&c=Validator) class. Once generated, you should modify by hand for your application.
Copy file name to clipboardExpand all lines: docs/2. Active Record.md
+11-5
Original file line number
Diff line number
Diff line change
@@ -25,11 +25,17 @@ $customer->update();
25
25
```
26
26
27
27
### Record::__construct
28
-
A **Record** can be constructed 4 ways:
29
-
-**int** primary key value, will load object values if the primary key value exists
30
-
-**string** primary key value, will load object values if the primary key value exists
31
-
-**array** object will be initialized to these values, but not read from the database
32
-
-**null** (default) constructs an empty object
28
+
A **Record** constructor attempts to read the specified row from the table. It can be constructed 4 ways:
29
+
-**int** primary key value, will load object values if the primary key value exists.
30
+
-**string** primary key value, will load object values if the primary key value exists.
31
+
-**array** record is attempted to be read from database using the values of the fields provided.
32
+
-**null** (default) constructs an empty object.
33
+
34
+
Both int and string parameters to the constructor are type checked. Calling the constructor with a parameter can be see as the same as, but with type checking:
0 commit comments