In the article class in the get by idees method we just created.
We're returning the rijkaard as an associative array.
However now that we have an article class we can return an object of this class instead.
We'll see next how this is useful when we're editing are deleting an article before we change this method
to return an object.
First let's add the articles properties to the class
at the moment.
Each article has four properties that come from the database table idae title content and published
at.
So let's add these as public properties of the class at the top and let's also add a p h.
P duck comments for each one.
The idae the title content and published at.
Then let's change the get by idees method to return an object instead of an array.
To do that we set the fetch mould of this statement object to fetch class using this set fetch mode
method.
So let's call this method on the statement object passing in the name of the class we want to be returned.
Then we can remove the fetch a succ flag from the fetch method call.
Now if the rijkaard with this idea is found an object of this article class will be returned.
Let's not forget to change the comment to to reflect the change we just made.
Let's give that a try.
If I click on a link to go to the individual article page we now get an error saying we can't use an
object as an array.
They get by idees method.
Now returns an object so we can't access it like an array like this.
We need to access the object property instead like this will do the same for the other three lines where
we're assessing the rijkaard to like that.
Now when we run the code the error is gone and were accessing the articles properties as an object as
opposed to an array.