Issues (5)

examples/Insert.php (1 issue)

Labels
Severity
1
<?php
2
3
require __DIR__.'/../vendor/autoload.php';
4
require __DIR__.'/config.php';
5
require __DIR__.'/Models/User.php';
6
7
/* NOTE: in case of error an exception is thrown */
8
9
/* It is necessary to set a value in all fields that cannot be null, otherwise a DatamanagerException will be thrown */
10
11
use HnrAzevedo\Datamanager\DatamanagerException;
12
use Model\User;
0 ignored issues
show
The type Model\User was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
14
try{
15
    $entity = new User();
16
17
    /* Set new info for insert in database */
18
    $entity->name = 'Henri Azevedo';
19
    $entity->email = '[email protected]';
20
    $entity->password = password_hash('123456', PASSWORD_DEFAULT);
21
    $entity->birth = '28/09/1996';
22
    $entity->register = date('Y-m-d H:i:s');
23
    $entity->weight = floatval('70.50');
24
25
    /* Insert entity in database */
26
    $entity->persist();
27
28
}catch(DatamanagerException $er){
29
30
    die("Code Error: {$er->getCode()}, Line: {$er->getLine()}, File: {$er->getFile()}, Message: {$er->getMessage()}.");
31
32
}