Re: Pyrus and SimpleChannelFrontend questions
| From: | Brett Bieber | Date: | Thu, 17 Jun 2010 13:23:32 +0000 |
| Subject: | Re: Pyrus and SimpleChannelFrontend questions | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-53574@lists.php.net to get a copy of this message | ||
On Wed, Jun 16, 2010 at 4:10 PM, Michael Gauthier <mike@silverorange.com> wrote:
> On Wed, 2010-06-16 at 15:07 -0500, Brett Bieber wrote:
>> On Wednesday, June 16, 2010, Michael Gauthier <mike@silverorange.com> wrote:
>> > On Wed, 2010-06-16 at 12:59 -0500, Brett Bieber wrote:
>> >> On Wednesday, June 16, 2010, Michael Gauthier <mike@silverorange.com> wrote:
>> >> > Hello,
>> >> >
>> >> > I'm working features for the PEAR2 website. The site uses Pyrus and
>> >> > SimpleChannelFrontend (SCF) as the data source.
>> >> >
>> >> > I have a few of questions about Pyrus and SCF:
>> >> >
>> >> > 1. I can get package dependencies of a package using:
>> >> > $package->dependencies['required']->package
>> >> > The returned object is iterable. How come it isn't also
>> >> > countable?
>> >> >
>> >> > 2. Similarly, how come I can iterate a package to get releases
>> >> > but can not count the package to count the number of releases?
>> >> >
>> >> > 3. How can I get a list of maintainers for a package including
>> >> > full name and email address?
>> >> >
>> >> > 4. How can I get a list of the categories a package belongs to?
>> >> >
>> >> > 5. Is there any documentation? Even the class docs in the source
>> >> > code are missing. This code is going to be hard to maintain in
>> >> > the future since there are no explanations present in the code.
>> >>
>> >> Your best bet is to look at the unit tests for pyrus, and help
>> >> document it. Basically you're using an object that represents the
>> >> package.xml file.
>> >>
>> > I had a look at the unit tests to get maintainers. In pear2web, when I
>> > do:
>> >
>> > foreach ($context->maintainer as $maintainer) {
>> > }
>> >
>> > I get:
>> >
>> > PEAR2\Pyrus\Channel\Exception: Unable to locate a package release for
>> > pear2.php.net/PEAR2_Autoload that can satisfy all dependencies
>> > in
>> > /so/servers/zest/sites/pearweb/pear2.php.net/trunk/includes/Pyrus/src/Pyrus/Channel/RemotePackage.php
>> > on line 832
>> >
>> > Any idea what I'm doing wrong?
>>
>> The default config uses preferred state of stable. Should probably set
>> it to devel for our purposes.
>>
>
> I'm not sure where the config is set for the PEAR2Web code.
This is actually the config for Pyrus... should just be $config = new
\PEAR2\Pyrus\Config(); $config->preferred_state = 'alpha'; or some
such thing. I would stick it in the config.inc.php. I figured there
were some other places I did something similar, but maybe not.
> I'm also making the menu into a savant template as you suggested. I'm
> having trouble passing the menu data as a context to the
> savant->render() call. Is it not possible to pass an array as a context?
Arrays are always assumed to be iterated over. In that sense, you
could make a template: <li><?php echo $context; ?></li>, but it's
probably easiest to just do $menu = new PEAR2Web\Menu();
$savant->render($menu); which will include a PEAR2Web/Menu.tpl.php
template file, with your $menu object as $context.
> I tried passing the array as an ArrayObject and it fails in a different
> way. Whey you pass ArrayObject it gets transformed into an ObjectProxy
> \Traversable object. Unfortunately, this object does not have the array
> access methods.
Yeah, there are some tricky things that happen variable escaping is
turned on and you pass a traversable object as the context. The array
access methods should be added in.
> I have a couple of other Savant questions as well:
>
> 1. Is there a method I can call to escape a value for display, or does
> this happen automatically?
This is already happening (hence the object proxy you're seeing).
Escaping is set up in www/index.php. Use ->getRaw('membervarname'); or
getRawObject(); to get the raw vars.
> 2. Is there a method I can call to tidy-indent a block of output?
Nothing I've written.
> Lastly, I've removed the <div class="clearfix"> elements. All this stuff
> is pending in my working copy until I can get the maintainers and menu
> template working.
aha, cool.
--
Brett Bieber