Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
MemberComparator.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ubiquity\orm\comparator
;
4
5
6
use
Ubiquity\cache\CacheManager
;
7
use
Ubiquity\orm\creator\Member
;
8
19
class
MemberComparator
{
20
protected
$member
;
21
protected
$class
;
22
protected
Member
$newMember
;
23
24
public
function
__construct
(
string
$class
,
string
$member
){
25
$this->
class
=
$class
;
26
$this->member=
$member
;
27
}
28
29
public
function
compareTo
(
Member
$member
){
30
$this->newMember=
$member
;
31
}
32
33
34
protected
function
getAnnotations
(
string
$class
,
string
$member
): array {
35
return
CacheManager
::getAnnotationsEngineInstance()->getAnnotsOfProperty(
$class
,
$member
);
36
}
37
38
public
function
compareAttributes
(){
39
$myAnnots=$this->getAnnotations($this->
class
,$this->member);
40
$otherAnnots=$this->newMember->getAnnotations();
41
$result=[];
42
foreach
($myAnnots as $myAnnot){
43
$index=$this->indexOfAnnotation($myAnnot,$otherAnnots);
44
if
($index===-1){
45
$result[]=$myAnnot;
46
}
47
}
48
return
$result;
49
}
50
51
protected
function
indexOfAnnotation
($annotation,array $annots){
52
$contains=-1;
53
foreach
($annots as $index=>$annot){
54
if
($annot->isSameAs($annotation)){
55
return
$index;
56
}
57
}
58
return
$contains;
59
}
60
61
public
function
maintain
(){
62
return \count(CacheManager::getAnnotationsEngineInstance()->getAnnotsOfProperty($this->
class
,$this->member,
'transient'
))>0;
63
}
64
}
Ubiquity\cache\CacheManager
Manager for caches (Router, Rest, models).
Definition
CacheManager.php:28
Ubiquity\orm\comparator\MemberComparator
Definition
MemberComparator.php:19
Ubiquity\orm\comparator\MemberComparator\compareAttributes
compareAttributes()
Definition
MemberComparator.php:38
Ubiquity\orm\comparator\MemberComparator\$class
$class
Definition
MemberComparator.php:21
Ubiquity\orm\comparator\MemberComparator\getAnnotations
getAnnotations(string $class, string $member)
Definition
MemberComparator.php:34
Ubiquity\orm\comparator\MemberComparator\$member
$member
Definition
MemberComparator.php:20
Ubiquity\orm\comparator\MemberComparator\maintain
maintain()
Definition
MemberComparator.php:61
Ubiquity\orm\comparator\MemberComparator\indexOfAnnotation
indexOfAnnotation($annotation, array $annots)
Definition
MemberComparator.php:51
Ubiquity\orm\comparator\MemberComparator\__construct
__construct(string $class, string $member)
Definition
MemberComparator.php:24
Ubiquity\orm\comparator\MemberComparator\$newMember
Member $newMember
Definition
MemberComparator.php:22
Ubiquity\orm\comparator\MemberComparator\compareTo
compareTo(Member $member)
Definition
MemberComparator.php:29
Ubiquity\orm\creator\Member
Definition
Member.php:18
Ubiquity\orm\comparator
Definition
ClassMerger.php:4
C:
Users
myadd
Documents
GitHub
ubiquity-doc-api
vendor
phpmv
ubiquity-dev
src
Ubiquity
orm
comparator
MemberComparator.php
Generated on Sun Dec 10 2023 15:04:08 for
Ubiquity
by
doxygen
1.9.8