1<?php 2 3declare(strict_types=1); 4 5namespace JMS\Serializer\Tests\Fixtures; 6 7use JMS\Serializer\Annotation as Serializer; 8 9/** 10 * @Serializer\VirtualProperty("firstName", exp="object.getFirstName()", options={@Serializer\SerializedName("my_first_name")}) 11 */ 12class AuthorExpressionAccess 13{ 14 private $id; 15 /** 16 * @Serializer\Exclude() 17 */ 18 private $firstName; 19 20 /** 21 * @Serializer\Exclude() 22 */ 23 private $lastName; 24 25 public function __construct($id, $firstName, $lastName) 26 { 27 $this->id = $id; 28 $this->firstName = $firstName; 29 $this->lastName = $lastName; 30 } 31 32 public function getFirstName() 33 { 34 return $this->firstName; 35 } 36 37 /** 38 * @Serializer\VirtualProperty() 39 */ 40 public function getLastName() 41 { 42 return $this->lastName; 43 } 44} 45