File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed
Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ namespace Learning ;
3+ use Bitrix \Main \Entity ;
4+
5+ class CourseSiteTable extends Entity \DataManager
6+ {
7+ /**
8+ * Returns DB table name for entity.
9+ *
10+ * @return string
11+ */
12+ public static function getTableName ()
13+ {
14+ return 'b_learn_course_site ' ;
15+ }
16+
17+ /**
18+ * Returns entity map definition.
19+ *
20+ * @return array
21+ */
22+ public static function getMap ()
23+ {
24+ return array (
25+ new Entity \IntegerField ('COURSE_ID ' , array (
26+ 'required ' => true ,
27+ 'primary ' => true
28+ )),
29+ new Entity \ReferenceField (
30+ 'COURSE ' ,
31+ '\Learning\CourseTable ' ,
32+ array ('=this.COURSE_ID ' => 'ref.ID ' ),
33+ array ('join_type ' => 'LEFT ' )
34+ ),
35+ new Entity \StringField ('SITE_ID ' , array (
36+ 'primary ' => true ,
37+ 'validation ' => array (__CLASS__ , 'validateSiteId ' ),
38+ )),
39+ new Entity \ReferenceField (
40+ 'SITE ' ,
41+ '\Bitrix\Main\SiteTable ' ,
42+ array ('=this.SITE_ID ' => 'ref.LID ' ),
43+ array ('join_type ' => 'LEFT ' )
44+ ),
45+ );
46+ }
47+ /**
48+ * Returns validators for SITE_ID field.
49+ *
50+ * @return array
51+ */
52+ public static function validateSiteId ()
53+ {
54+ return array (
55+ new Main \Entity \Validator \Length (null , 2 ),
56+ );
57+ }
58+ }
You can’t perform that action at this time.
0 commit comments