Search code examples
phpsyntaxarraysprojectpier

How to read complex PHP arrays?


I've been working with ProjectPier, and found arrays like the following. How do I read this architecture with PHP?

ApplicationLog Object
(
[is_new:DataObject:private] => 
[is_deleted:DataObject:private] => 
[is_loaded:DataObject:private] => 1
[column_values:DataObject:private] => Array
    (
        [id] => 24
        [taken_by_id] => 1
        [project_id] => 2
        [rel_object_id] => 7
        [object_name] => screenshots
        [rel_object_manager] => ProjectFolders
        [created_on] => DateTimeValue Object
            (
                [timestamp:DateTimeValue:private] => 1264869022
                [day:DateTimeValue:private] => 30
                [month:DateTimeValue:private] => 1
                [year:DateTimeValue:private] => 2010
                [hour:DateTimeValue:private] => 16
                [minute:DateTimeValue:private] => 30
                [second:DateTimeValue:private] => 22
            )

        [created_by_id] => 1
        [action] => add
        [is_private] => 
        [is_silent] => 
    )

Solution

  • I downloaded ProjectPier and searched for the ApplicationLog class, (application/models/application_logs/ApplicationLog.class.php and application/models/application_logs/base/BaseApplicationLog.class.php)

    which offers you a variety of getters (and setters):

    function getTakenBy()
    function getTakenByDisplayName() 
    function getProject()
    function getText() 
    function getObject() 
    function getObjectUrl() 
    function getObjectTypeName()
    function getId()
    function getTakenById()
    function getProjectId()
    function getRelObjectId() 
    function getObjectName() 
    function getRelObjectManager()
    function getCreatedOn() 
    function getCreatedById()
    function getAction() 
    function getIsPrivate()
    function getIsSilent()
    function manager() 
    

    You can access the column_values['id'] for example by $applicationLog->getId().