40
40
* @param Utopia\Database\Document $attribute
41
41
* @param Appwrite\Utopia\Response $response
42
42
* @param Utopia\Database\Database $dbForInternal
43
+ * @param Utopia\Database\Database $dbForExternal
43
44
* @param Appwrite\Event\Event $database
44
45
* @param Appwrite\Event\Event $audits
45
46
* @param Appwrite\Stats\Stats $usage
46
47
*
47
48
* @return Document Newly created attribute document
48
49
*/
49
- function createAttribute ($ collectionId , $ attribute , $ response , $ dbForInternal , $ database , $ audits , $ usage ): Document
50
+ function createAttribute ($ collectionId , $ attribute , $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage ): Document
50
51
{
51
52
$ attributeId = $ attribute ->getId ();
52
53
$ type = $ attribute ->getAttribute ('type ' , '' );
@@ -107,6 +108,7 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
107
108
}
108
109
109
110
$ dbForInternal ->deleteCachedDocument ('collections ' , $ collectionId );
111
+ $ dbForExternal ->deleteCachedCollection ($ collectionId );
110
112
111
113
// Pass clone of $attribute object to workers
112
114
// so we can later modify Document to fit response model
@@ -688,12 +690,14 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
688
690
->param ('array ' , false , new Boolean (), 'Is attribute an array? ' , true )
689
691
->inject ('response ' )
690
692
->inject ('dbForInternal ' )
693
+ ->inject ('dbForExternal ' )
691
694
->inject ('database ' )
692
695
->inject ('audits ' )
693
696
->inject ('usage ' )
694
- ->action (function ($ collectionId , $ attributeId , $ size , $ required , $ default , $ array , $ response , $ dbForInternal , $ database , $ audits , $ usage ) {
697
+ ->action (function ($ collectionId , $ attributeId , $ size , $ required , $ default , $ array , $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage ) {
695
698
/** @var Appwrite\Utopia\Response $response */
696
699
/** @var Utopia\Database\Database $dbForInternal*/
700
+ /** @var Utopia\Database\Database $dbForExternal*/
697
701
/** @var Appwrite\Event\Event $database */
698
702
/** @var Appwrite\Event\Event $audits */
699
703
/** @var Appwrite\Stats\Stats $usage */
@@ -711,7 +715,7 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
711
715
'required ' => $ required ,
712
716
'default ' => $ default ,
713
717
'array ' => $ array ,
714
- ]), $ response , $ dbForInternal , $ database , $ audits , $ usage );
718
+ ]), $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage );
715
719
716
720
$ response ->dynamic ($ attribute , Response::MODEL_ATTRIBUTE_STRING );
717
721
});
@@ -735,12 +739,14 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
735
739
->param ('array ' , false , new Boolean (), 'Is attribute an array? ' , true )
736
740
->inject ('response ' )
737
741
->inject ('dbForInternal ' )
742
+ ->inject ('dbForExternal ' )
738
743
->inject ('database ' )
739
744
->inject ('audits ' )
740
745
->inject ('usage ' )
741
- ->action (function ($ collectionId , $ attributeId , $ required , $ default , $ array , $ response , $ dbForInternal , $ database , $ audits , $ usage ) {
746
+ ->action (function ($ collectionId , $ attributeId , $ required , $ default , $ array , $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage ) {
742
747
/** @var Appwrite\Utopia\Response $response */
743
748
/** @var Utopia\Database\Database $dbForInternal*/
749
+ /** @var Utopia\Database\Database $dbForExternal*/
744
750
/** @var Appwrite\Event\Event $database */
745
751
/** @var Appwrite\Event\Event $audits */
746
752
/** @var Appwrite\Stats\Stats $usage */
@@ -753,7 +759,7 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
753
759
'default ' => $ default ,
754
760
'array ' => $ array ,
755
761
'format ' => APP_DATABASE_ATTRIBUTE_EMAIL ,
756
- ]), $ response , $ dbForInternal , $ database , $ audits , $ usage );
762
+ ]), $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage );
757
763
758
764
$ response ->dynamic ($ attribute , Response::MODEL_ATTRIBUTE_EMAIL );
759
765
});
@@ -778,12 +784,14 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
778
784
->param ('array ' , false , new Boolean (), 'Is attribute an array? ' , true )
779
785
->inject ('response ' )
780
786
->inject ('dbForInternal ' )
787
+ ->inject ('dbForExternal ' )
781
788
->inject ('database ' )
782
789
->inject ('audits ' )
783
790
->inject ('usage ' )
784
- ->action (function ($ collectionId , $ attributeId , $ elements , $ required , $ default , $ array , $ response , $ dbForInternal , $ database , $ audits , $ usage ) {
791
+ ->action (function ($ collectionId , $ attributeId , $ elements , $ required , $ default , $ array , $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage ) {
785
792
/** @var Appwrite\Utopia\Response $response */
786
793
/** @var Utopia\Database\Database $dbForInternal*/
794
+ /** @var Utopia\Database\Database $dbForExternal*/
787
795
/** @var Appwrite\Event\Event $database */
788
796
/** @var Appwrite\Event\Event $audits */
789
797
/** @var Appwrite\Stats\Stats $usage */
@@ -808,7 +816,7 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
808
816
'array ' => $ array ,
809
817
'format ' => APP_DATABASE_ATTRIBUTE_ENUM ,
810
818
'formatOptions ' => ['elements ' => $ elements ],
811
- ]), $ response , $ dbForInternal , $ database , $ audits , $ usage );
819
+ ]), $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage );
812
820
813
821
$ response ->dynamic ($ attribute , Response::MODEL_ATTRIBUTE_ENUM );
814
822
});
@@ -832,12 +840,14 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
832
840
->param ('array ' , false , new Boolean (), 'Is attribute an array? ' , true )
833
841
->inject ('response ' )
834
842
->inject ('dbForInternal ' )
843
+ ->inject ('dbForExternal ' )
835
844
->inject ('database ' )
836
845
->inject ('audits ' )
837
846
->inject ('usage ' )
838
- ->action (function ($ collectionId , $ attributeId , $ required , $ default , $ array , $ response , $ dbForInternal , $ database , $ audits , $ usage ) {
847
+ ->action (function ($ collectionId , $ attributeId , $ required , $ default , $ array , $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage ) {
839
848
/** @var Appwrite\Utopia\Response $response */
840
849
/** @var Utopia\Database\Database $dbForInternal*/
850
+ /** @var Utopia\Database\Database $dbForExternal*/
841
851
/** @var Appwrite\Event\Event $database */
842
852
/** @var Appwrite\Event\Event $audits */
843
853
/** @var Appwrite\Stats\Stats $usage */
@@ -850,7 +860,7 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
850
860
'default ' => $ default ,
851
861
'array ' => $ array ,
852
862
'format ' => APP_DATABASE_ATTRIBUTE_IP ,
853
- ]), $ response , $ dbForInternal , $ database , $ audits , $ usage );
863
+ ]), $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage );
854
864
855
865
$ response ->dynamic ($ attribute , Response::MODEL_ATTRIBUTE_IP );
856
866
});
@@ -874,10 +884,11 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
874
884
->param ('array ' , false , new Boolean (), 'Is attribute an array? ' , true )
875
885
->inject ('response ' )
876
886
->inject ('dbForInternal ' )
887
+ ->inject ('dbForExternal ' )
877
888
->inject ('database ' )
878
889
->inject ('audits ' )
879
890
->inject ('usage ' )
880
- ->action (function ($ collectionId , $ attributeId , $ required , $ default , $ array , $ response , $ dbForInternal , $ database , $ audits , $ usage ) {
891
+ ->action (function ($ collectionId , $ attributeId , $ required , $ default , $ array , $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage ) {
881
892
/** @var Appwrite\Utopia\Response $response */
882
893
/** @var Utopia\Database\Database $dbForExternal*/
883
894
/** @var Appwrite\Event\Event $database */
@@ -892,7 +903,7 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
892
903
'default ' => $ default ,
893
904
'array ' => $ array ,
894
905
'format ' => APP_DATABASE_ATTRIBUTE_URL ,
895
- ]), $ response , $ dbForInternal , $ database , $ audits , $ usage );
906
+ ]), $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage );
896
907
897
908
$ response ->dynamic ($ attribute , Response::MODEL_ATTRIBUTE_URL );
898
909
});
@@ -918,12 +929,14 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
918
929
->param ('array ' , false , new Boolean (), 'Is attribute an array? ' , true )
919
930
->inject ('response ' )
920
931
->inject ('dbForInternal ' )
932
+ ->inject ('dbForExternal ' )
921
933
->inject ('database ' )
922
934
->inject ('audits ' )
923
935
->inject ('usage ' )
924
- ->action (function ($ collectionId , $ attributeId , $ required , $ min , $ max , $ default , $ array , $ response , $ dbForInternal , $ database , $ audits , $ usage ) {
936
+ ->action (function ($ collectionId , $ attributeId , $ required , $ min , $ max , $ default , $ array , $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage ) {
925
937
/** @var Appwrite\Utopia\Response $response */
926
938
/** @var Utopia\Database\Database $dbForInternal*/
939
+ /** @var Utopia\Database\Database $dbForExternal*/
927
940
/** @var Appwrite\Event\Event $database */
928
941
/** @var Appwrite\Event\Event $audits */
929
942
/** @var Appwrite\Stats\Stats $usage */
@@ -954,7 +967,7 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
954
967
'min ' => $ min ,
955
968
'max ' => $ max ,
956
969
],
957
- ]), $ response , $ dbForInternal , $ database , $ audits , $ usage );
970
+ ]), $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage );
958
971
959
972
$ formatOptions = $ attribute ->getAttribute ('formatOptions ' , []);
960
973
@@ -987,12 +1000,14 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
987
1000
->param ('array ' , false , new Boolean (), 'Is attribute an array? ' , true )
988
1001
->inject ('response ' )
989
1002
->inject ('dbForInternal ' )
1003
+ ->inject ('dbForExternal ' )
990
1004
->inject ('database ' )
991
1005
->inject ('audits ' )
992
1006
->inject ('usage ' )
993
- ->action (function ($ collectionId , $ attributeId , $ required , $ min , $ max , $ default , $ array , $ response , $ dbForInternal , $ database , $ audits , $ usage ) {
1007
+ ->action (function ($ collectionId , $ attributeId , $ required , $ min , $ max , $ default , $ array , $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage ) {
994
1008
/** @var Appwrite\Utopia\Response $response */
995
1009
/** @var Utopia\Database\Database $dbForInternal*/
1010
+ /** @var Utopia\Database\Database $dbForExternal*/
996
1011
/** @var Appwrite\Event\Event $database */
997
1012
/** @var Appwrite\Event\Event $audits */
998
1013
/** @var Appwrite\Stats\Stats $usage */
@@ -1023,7 +1038,7 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
1023
1038
'min ' => $ min ,
1024
1039
'max ' => $ max ,
1025
1040
],
1026
- ]), $ response , $ dbForInternal , $ database , $ audits , $ usage );
1041
+ ]), $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage );
1027
1042
1028
1043
$ formatOptions = $ attribute ->getAttribute ('formatOptions ' , []);
1029
1044
@@ -1054,10 +1069,11 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
1054
1069
->param ('array ' , false , new Boolean (), 'Is attribute an array? ' , true )
1055
1070
->inject ('response ' )
1056
1071
->inject ('dbForInternal ' )
1072
+ ->inject ('dbForExternal ' )
1057
1073
->inject ('database ' )
1058
1074
->inject ('audits ' )
1059
1075
->inject ('usage ' )
1060
- ->action (function ($ collectionId , $ attributeId , $ required , $ default , $ array , $ response , $ dbForInternal , $ database , $ audits , $ usage ) {
1076
+ ->action (function ($ collectionId , $ attributeId , $ required , $ default , $ array , $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage ) {
1061
1077
/** @var Appwrite\Utopia\Response $response */
1062
1078
/** @var Utopia\Database\Database $dbForInternal*/
1063
1079
/** @var Appwrite\Event\Event $database */
@@ -1071,7 +1087,7 @@ function createAttribute($collectionId, $attribute, $response, $dbForInternal, $
1071
1087
'required ' => $ required ,
1072
1088
'default ' => $ default ,
1073
1089
'array ' => $ array ,
1074
- ]), $ response , $ dbForInternal , $ database , $ audits , $ usage );
1090
+ ]), $ response , $ dbForInternal , $ dbForExternal , $ database , $ audits , $ usage );
1075
1091
1076
1092
$ response ->dynamic ($ attribute , Response::MODEL_ATTRIBUTE_BOOLEAN );
1077
1093
});
0 commit comments