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: src/app/core/asynchronous/asynchronous.component.html
+7-3Lines changed: 7 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -91,14 +91,16 @@ <h3>Async/Await Pattern</h3>
91
91
The async/await pattern is a feature related to the coroutine concept, where the async function can use the await operator to suspend the asynchronous operation until that operation completes and then returns a result. This enables asynchronous non-blocking functions to be structured like normal synchronous functions in the enclosing scope without blocking the main thread during the execution of the async function, which also returns a task object that represents an asynchronous operation and provides a result when the task completes successfully.
Copy file name to clipboardExpand all lines: src/app/core/extension/extension.component.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ <h3>Extension class</h3>
51
51
<br>
52
52
<h3>Calling the extension method</h3>
53
53
<pclass="text-justify">
54
-
To call an extension method as if it were an instance method on a particular extended class, the extension class must be brought into the scope of the same file where that instance calls the extension method, using the keyword <code>use</code>
54
+
To call an extension method as if it were an instance method on a particular extended class, the extension class must be brought into the same scope where that instance calls the extension method, using the keyword <code>use</code>
Copy file name to clipboardExpand all lines: src/app/core/overview/overview.component.html
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ <h1>Overview</h1>
11
11
DevNet Core is the heart of the DevNet framework, and all of its components rely on it. It is a base class library that provides several fundamental features that make it easier to develop applications in PHP. These features include:
12
12
</p>
13
13
<ul>
14
-
<li>Computed Properties</li>
14
+
<li>Accessor Properties</li>
15
15
<li>Extension Methods</li>
16
16
<li>LINQ Methods</li>
17
17
<li>Generic Types</li>
@@ -22,7 +22,7 @@ <h1>Overview</h1>
22
22
<br>
23
23
<h3>Installation</h3>
24
24
<p>
25
-
If you have installed any of the DevNet packages in your system or project, then you already have the DevNet Core. However, you can still install DevNet Core as a third-party library to work with any frameworks by running the following command in the terminal using composer:
25
+
If you have installed any of the DevNet packages in your system or project, then you already have the DevNet Core. However, you can still install DevNet Core as a third-party library to work with any PHP project by running the following command in the terminal using composer:
A computed property is a property that doesn't store a value directly. Instead, it uses a getter and a setter method to retrieve and set other properties indirectly.
11
+
Accessor properties are methods that look like regular data properties from the outside but are invoked as methods internally when accessed as properties. This allows us to define custom logic for reading and writing the values of an object's properties, with more control over the property's behavior, such as how to validate or modify the input or output, unlike the data properties, which directly store a fixed value.
12
12
</p>
13
-
<h3>Getter</h3>
14
13
<p>
15
-
A getter is a function bound to a computed property and returns a value when that property is looked up.
14
+
To enable the accessor property feature, you need to include the trait <code>DevNet\System\PropertyTrait</code> in your class.
16
15
</p>
16
+
<h3>Getter Accessor</h3>
17
17
<p>
18
-
To use a getter for a computed property in DevNet, you need first to include the trait <code>DevNet\System\PropertyTrait</code> in your class to enable this feature, then define the computed property as a method prefixed with <code>get</code> that returns a value.
18
+
The getter accessor is a function bound to a computed property and returns a value when that property is looked up.
19
+
</p>
20
+
<p>
21
+
Here is an example that shows how to define a getter accessor property, which is a method that has a property name prefixed with <code>get_</code> accessor and return a value.
19
22
</p>
20
23
<pre><codeclass="language-php"><?php
21
24
@@ -30,7 +33,7 @@ <h3>Getter</h3>
30
33
public string $FirstName;
31
34
public string $LastName;
32
35
33
-
// Defining the getter computed property.
36
+
// Computed property with getter accessor.
34
37
public function get_FullName(): string
35
38
{
36
39
return $this->FirstName . ' ' . $this->LastName;
@@ -53,12 +56,12 @@ <h3>Getter</h3>
53
56
print($person->FullName); // Output: John Doe
54
57
</code></pre>
55
58
<br>
56
-
<h3>Setter</h3>
59
+
<h3>Setter Accessor</h3>
57
60
<p>
58
-
A setter is a function bound to a computed property and will be called when there is an attempt to set that property.
61
+
The setter accessor is a function bound to a computed property and will be called when there is an attempt to set that property.
59
62
</p>
60
63
<p>
61
-
To use a setter for a computed property, you need to include the trait <code>DevNet\System\PropertyTrait</code> in your class to enable this feature, then define the computed property as a method prefixed with <code>set</code>that has a value as a parameter.
64
+
The following example shows how to define a setter accessor property as a method prefixed with <code>set_</code>accessor and take a value parameter to set object.
<b>Important:</b> Make sure to specify the database configuration in the <samp><b>settings.json</b></samp> before running the <code>migrate</code> command or pass it to the command as parameters using the options: <code>--provider</code> and <code>--connection</code>.
You can register Entity ORM as a reused service that will be injected into your application using the Extension method <code>ServiceCollectionExtensions::addEntityContext()</code>inside the method<code>WebHostBuilder::register()</code>, as shown in the following code example:
190
+
It is recommended that you register the Entity ORM as a reusable service to be injected into your application using the <code>ServiceCollectionExtensions::addEntityContext()</code>Extension method, which is called within the <code>WebHostBuilder::register()</code> method, with the use of the configuration provider that gets the database configuration from the <samp>"settings.json"</samp> file as shown in the following code example:
191
191
</p>
192
192
<pre><codeclass="language-php"><?php
193
193
194
194
namespace Application;
195
195
196
+
use Application\Models\BlogContext;
196
197
use DevNet\Web\Hosting\WebHost;
197
198
use DevNet\Web\Extensions\ApplicationBuilderExtensions;
198
199
use DevNet\Web\Extensions\ServiceCollectionExtensions;
199
-
use DevNet\Entity\MySql\MySqlDataProvider;
200
-
use Application\Models\BlogContext;
201
200
202
201
class Program
203
202
{
204
203
public static function main(array $args = [])
205
204
{
206
205
$builder = WebHost::createDefaultBuilder($args);
207
-
$builder->register(function ($services) {
206
+
$configuration = $builder->Configuration;
207
+
$builder->register(function ($services) use ($configuration) { //;
@@ -218,18 +218,26 @@ <h3>Registering the EntityContext</h3>
218
218
}
219
219
</code></pre>
220
220
<p>
221
-
You can then get the EntityContext using the constructor injection to add the EntityContext to the controller class and use it in the controller methods like the following example:
221
+
In the <samp>"settings.json"</samp> file, you need to set the database configuration, like in the following example:
0 commit comments