Issues (538)

programs/Set/AppCustomSectionSet.php (10 issues)

1
<?php
2
3
// -------------------------------------------------------------------------
4
// OVIDENTIA http://www.ovidentia.org
5
// Ovidentia is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation; either version 2, or (at your option)
8
// any later version.
9
//
10
// This program is distributed in the hope that it will be useful, but
11
// WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
// See the GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with this program; if not, write to the Free Software
17
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18
// USA.
19
// -------------------------------------------------------------------------
20
/**
21
 * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
22
 * @copyright Copyright (c) 2022 by SI4YOU ({@link https://www.siforyou.com})
23
 */
24
namespace Capwelton\LibApp\Set;
25
26
use Capwelton\LibApp\Func_App;
27
use Capwelton\LibOrm\Criteria\ORMCriteria;
0 ignored issues
show
The type Capwelton\LibOrm\Criteria\ORMCriteria 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...
28
use Capwelton\LibOrm\MySql\ORMMySqlIterator;
0 ignored issues
show
The type Capwelton\LibOrm\MySql\ORMMySqlIterator 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...
29
30
use function Capwelton\LibOrm\ORM_StringField;
0 ignored issues
show
The function Capwelton\LibOrm\ORM_StringField was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
31
use function Capwelton\LibOrm\ORM_TextField;
0 ignored issues
show
The function Capwelton\LibOrm\ORM_TextField was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
32
use function Capwelton\LibOrm\ORM_EnumField;
0 ignored issues
show
The function Capwelton\LibOrm\ORM_EnumField was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
33
use function Capwelton\LibOrm\ORM_BoolField;
0 ignored issues
show
The function Capwelton\LibOrm\ORM_BoolField was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
34
use function Capwelton\LibOrm\ORM_IntField;
0 ignored issues
show
The function Capwelton\LibOrm\ORM_IntField was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
35
36
/**
37
 * @property ORM_StringField $name
38
 * @property ORM_StringField $fieldname
39
 * @property ORM_TextField $description
40
 * @property ORM_EnumField $object
41
 * @property ORM_StringField $view
42
 * @property ORM_TextField $fields
43
 * @property ORM_StringField $classname
44
 * @property ORM_StringField $sizePolicy
45
 * @property ORM_EnumField $fieldsLayout
46
 * @property ORM_BoolField $foldable
47
 * @property ORM_BoolField $folded
48
 * @property ORM_StringField $rank
49
 * @property ORM_TextField $visibilityCriteria
50
 *
51
 * @property app_CustomContainerSet $container
52
 * @method app_CustomContainerSet container()
53
 * @method app_CustomSection get(mixed $criteria)
54
 * @method app_CustomSection request(mixed $criteria)
55
 * @method app_CustomSection[]|ORMMySqlIterator select(\ORM_Criteria $criteria = null)
56
 * @method app_CustomSection newRecord()
57
 * @method Func_App App()
58
 */
59
class AppCustomSectionSet extends AppTraceableRecordSet
60
{
61
    
62
    /**
63
     * @param Func_App $App
64
     */
65
    public function __construct(Func_App $App)
66
    {
67
        parent::__construct($App);
68
        $this->setTableName("app_customsection");
69
        
70
        $this->setDescription('Custom section');
71
        
72
        $this->setPrimaryKey('id');
73
        
74
        $this->addFields(
75
            ORM_StringField('name')->setDescription('Name of section used for display'), 
76
            ORM_StringField('sectionname')->setDescription('Internal name of section'), 
77
            ORM_TextField('description')->setDescription('Optional description'), 
78
            ORM_StringField('object')->setDescription('Name of object in CRM ex : Article, Contact, Organization...'), 
79
            ORM_StringField('view')->setDescription('The specific view'), 
80
            ORM_TextField('fields')->setDescription('Contained fields and their parameters'), 
81
            ORM_StringField('sizePolicy')->setDescription($App->translatable('Size policy')), 
82
            ORM_StringField('classname')->setDescription($App->translatable('Classname')), 
83
            ORM_EnumField('fieldsLayout', AppCustomSection::getFieldsLayouts())->setDescription($App->translatable('Fields layout')), 
84
            ORM_BoolField('foldable')->setDescription($App->translatable('Foldable')), 
85
            ORM_BoolField('folded')->setDescription($App->translatable('Folded')), 
86
            ORM_BoolField('editable')->setDescription($App->translatable('Editable')), 
87
            ORM_IntField('rank')->setDescription($App->translatable('Rank')), 
88
            ORM_TextField('visibilityCriteria')->setDescription($App->translatable('Visibility criteria'))
89
        );
90
        
91
        $this->hasOne('container', $App->CustomContainerSetClassName())
0 ignored issues
show
The method CustomContainerSetClassName() does not exist on Capwelton\LibApp\Func_App. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

91
        $this->hasOne('container', $App->/** @scrutinizer ignore-call */ CustomContainerSetClassName())
Loading history...
92
            ->setDescription($App->translatable('Container'));
93
    }
94
    
95
    /**
96
     * {@inheritdoc}
97
     * @see AppRecordSet::isCreatable()
98
     */
99
    public function isCreatable()
100
    {
101
        return true;
102
        return $this->App()
0 ignored issues
show
return $this->App()->Access()->administer() is not reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
103
            ->Access()
104
            ->administer();
105
    }
106
    
107
    /**
108
     * @return ORMCriteria
109
     */
110
    public function isReadable()
111
    {
112
        return $this->all();
113
    }
114
    
115
    /**
116
     * @return ORMCriteria
117
     */
118
    public function isUpdatable()
119
    {
120
        return $this->all();
121
        if($this->App()
0 ignored issues
show
IfNode is not reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
122
            ->Access()
123
            ->administer()){
124
            return $this->all();
125
        }
126
        return $this->none();
127
    }
128
    
129
    /**
130
     * @return ORMCriteria
131
     */
132
    public function isDeletable()
133
    {
134
        return $this->isUpdatable();
135
    }
136
}