prismicio-community / php-kit

Community maintained development kit for Prismic and the PHP language
https://prismic.io
Other
109 stars 83 forks source link

Provide has() method to Document #16

Closed adamgoose closed 10 years ago

adamgoose commented 11 years ago

This will provide a way to test for the presence of a fragment, and prevent the "Undefined variable $single" error that's thrown by the get() method when the fragment doesn't exist.

dohzya commented 10 years ago

I agree a such method is useful, but I'm not sure I get the reason you explained: can you give me an example or get() call which results on the error you described?

Besides, could you add some basic tests? Like calling has("field") with:

This method is part of the API so we must prevent regressions… and changing behavior is a regression for existing user code :-)