To make this method a little easier, I wrap the access to the variable in a second function that takes a configuration key name and a default value, as shown below.
The simplest way to access persistent data is by using the find method. Here is an example of an application using the entity manager to find an object by its primary key.
最简单的访问持久性数据的方法是使用find方法。
3
In all cases, the return value of the method can be processed using a foreach loop, and you can also access specific values by key as needed.