modules/Documents/relations/GetRelatedRecord.php
Missing class import via use statement (line '60', column '19'). Open
Open
$modules = (new \App\Db\Query())->select(['vtiger_tab.name'])
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\App\Privilege' in method 'getConfigAdvancedConditionsByColumns'. Open
Open
if (!\App\Privilege::isPermitted($moduleName)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Call to method addJoin
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
Open
$queryGenerator->addJoin(['INNER JOIN', $tableName, "{$tableName}.notesid = vtiger_crmentity.crmid"])
- Exclude checks
Parameter $queryGenerator
has undeclared type \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
Open
public function loadAdvancedConditionsByColumns(App\QueryGenerator $queryGenerator, array $searchParam): void
- Exclude checks
Call to method addNativeCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
Open
$queryGenerator->addNativeCondition(["{$tableName}.notesid" => $this->relationModel->get('parentRecord')->getId()]);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
Open
return (bool) App\Db::getInstance()->createCommand()->delete(self::TABLE_NAME, [
- Exclude checks
Call to method addJoin
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
Open
$queryGenerator->addJoin(['INNER JOIN', $tableName, "{$tableName}.crmid = vtiger_crmentity.crmid"]);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
Open
$modules = (new \App\Db\Query())->select(['vtiger_tab.name'])
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class Documents_GetRelatedRecord_Relation extends \App\Relation\RelationAbstraction
- Exclude checks
The class Documents_GetRelatedRecord_Relation is not named in CamelCase. Open
Open
class Documents_GetRelatedRecord_Relation extends \App\Relation\RelationAbstraction
{
/**
* @var string Name of the table that stores relations.
*/
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
Open
$queryGenerator->addNativeCondition(["{$tableName}.notesid" => $this->relationModel->get('parentRecord')->getId()]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param App\QueryGenerator $queryGenerator QueryGenerator for the list of records to be tapered based on the relationship
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getConfigAdvancedConditionsByColumns(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return ['relatedModules' => $modules];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Load advanced conditions relationship by custom column.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function loadAdvancedConditionsByColumns(App\QueryGenerator $queryGenerator, array $searchParam): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
->addNativeCondition(["{$tableName}.crmid" => $searchParam['value']]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function create(int $sourceRecordId, int $destinationRecordId): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getRelationType(): int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$queryGenerator->addJoin(['INNER JOIN', $tableName, "{$tableName}.crmid = vtiger_crmentity.crmid"]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
unset($modules[$key]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
->innerJoin('vtiger_tab', 'vtiger_tab.tabid = vtiger_relatedlists.tabid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$queryGenerator->addNativeCondition(["{$tableName}.notesid" => $this->relationModel->get('parentRecord')->getId()]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$queryGenerator->addJoin(['INNER JOIN', $tableName, "{$tableName}.notesid = vtiger_crmentity.crmid"])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$modules = (new \App\Db\Query())->select(['vtiger_tab.name'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
->where(['and', ['vtiger_tab.presence' => 0], ['vtiger_relatedlists.name' => 'getAttachments']])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
foreach ($modules as $key => $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'crmid' => $destinationRecordId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @var string Name of the table that stores relations.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$queryGenerator = $this->relationModel->getQueryGenerator();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$tableName = self::TABLE_NAME;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Get configuration advanced conditions relationship by custom column..
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
->from('vtiger_relatedlists')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (!\App\Privilege::isPermitted($moduleName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'notesid' => $sourceRecordId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return Vtiger_Relation_Model::RELATION_M2M;
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
Open
* @param App\QueryGenerator $queryGenerator QueryGenerator for the list of records to be tapered based on the relationship
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return (bool) App\Db::getInstance()->createCommand()->delete(self::TABLE_NAME, [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function transfer(int $relatedRecordId, int $fromRecordId, int $toRecordId): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public const TABLE_NAME = 'vtiger_senotesrel';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getQuery()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param array $searchParam Related record for which we are filtering the list of records
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$tableName = static::TABLE_NAME;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function delete(int $sourceRecordId, int $destinationRecordId): bool
- Exclude checks
Class name "Documents_GetRelatedRecord_Relation" is not in camel caps format Open
Open
class Documents_GetRelatedRecord_Relation extends \App\Relation\RelationAbstraction
- Exclude checks