1 00:00:00,210 --> 00:00:03,040 When we tried to upgrade a listing, we got an error. 2 00:00:03,040 --> 00:00:05,550 No such column, allowed tags. 3 00:00:05,550 --> 00:00:08,000 Let's go look at the update method. 4 00:00:08,000 --> 00:00:12,248 All database interactions are part of the collection class so we need to look there. 5 00:00:12,248 --> 00:00:20,970 [Blank Audio] update. 6 00:00:20,970 --> 00:00:24,040 We pass the data to add a listing. 7 00:00:24,040 --> 00:00:29,260 Then we call toArray on that listening to get the object properties as an array. 8 00:00:29,260 --> 00:00:33,990 We then loop through the array to form the key value placeholders. 9 00:00:33,990 --> 00:00:36,150 Let's take a look at the SQL that's generated. 10 00:00:41,700 --> 00:00:43,180 And we'll just exit here. 11 00:00:46,940 --> 00:00:49,577 We can see all the properties of the parent, 12 00:00:49,577 --> 00:00:54,320 plus it added the allowed_tags property, but not the description. 13 00:00:54,320 --> 00:00:56,550 Let's go back to the premium class properties. 14 00:00:59,520 --> 00:01:05,010 Because the description is private, and the two-array method is on the parent, 15 00:01:05,010 --> 00:01:08,640 the parent doesn't know anything about this private property. 16 00:01:08,640 --> 00:01:12,630 We could override the method like we did with the set values method, but 17 00:01:12,630 --> 00:01:14,350 let's see what else we can do. 18 00:01:14,350 --> 00:01:16,990 We know that the protected visibility works 19 00:01:16,990 --> 00:01:20,030 because the allowed tags are being added. 20 00:01:20,030 --> 00:01:22,120 So we can set the description to protected. 21 00:01:26,574 --> 00:01:29,970 Protected will let our parent class know about the property. 22 00:01:29,970 --> 00:01:33,690 But still keep it from being accessed from outside the class. 23 00:01:33,690 --> 00:01:38,750 We do not want the allowed tags in our listing so we could make that private. 24 00:01:38,750 --> 00:01:41,870 But we may want to allow these to be overridden 25 00:01:41,870 --> 00:01:46,590 I do want to make the allowed tags accessible without creating an object. 26 00:01:46,590 --> 00:01:49,080 So I would need to make this property static. 27 00:01:49,080 --> 00:01:51,200 So let's go ahead and make this protected static. 28 00:01:52,570 --> 00:01:54,110 Now let's take a look in the browser again. 29 00:01:56,470 --> 00:02:01,920 The SQL looks good, it has the description and not the allowed tags. 30 00:02:01,920 --> 00:02:03,720 But now we're getting a notice. 31 00:02:03,720 --> 00:02:09,230 Accessing static property listing premium allowed tags as non static. 32 00:02:09,230 --> 00:02:12,080 Well that's why our two-array actually worked. 33 00:02:12,080 --> 00:02:14,770 Because we can't access a static property 34 00:02:14,770 --> 00:02:17,800 in the same way as we access a normal property. 35 00:02:17,800 --> 00:02:19,730 Let's update our set description method. 36 00:02:26,550 --> 00:02:31,816 To access a static property, we need to use the keyword self, 37 00:02:31,816 --> 00:02:39,140 and then two colons, and then the property, starting with the dollar sign. 38 00:02:39,140 --> 00:02:39,830 Let's try now. 39 00:02:42,420 --> 00:02:46,180 Great, that fixed the error, and the SQL still looks good. 40 00:02:46,180 --> 00:02:48,850 Let's go back and remove our debugging and see what happens. 41 00:02:57,467 --> 00:02:59,381 Great, the listing has been updated, 42 00:02:59,381 --> 00:03:02,710 but the listing page isn't showing the description. 43 00:03:02,710 --> 00:03:06,240 Also, we never told the user which tags are allowed. 44 00:03:06,240 --> 00:03:09,240 That's why I wanted the allowed tags to be static. 45 00:03:09,240 --> 00:03:11,620 In the next video, we'll add some finishing touches.