It's been a while since I dealt with Zend_Tool, but if you take a look at:

http://github.com/inxilpro/Galahad-FE/tree/master/library/Galahad/Tool/Project/

You can probably get a sense of how to get Zend_Tool to generate new files
and add them to the .zfproject XML for you.

CM

  <http://cmorrell.com/> *Chris Morrell*  Web: http://cmorrell.com  Twitter:
@inxilpro <http://twitter.com/inxilpro>


On Tue, Apr 13, 2010 at 12:56 PM, keith Pope <[email protected]>wrote:

> Hi,
>
> I want to add a new directory context for a provider I am creating,
> how do you add a new node to the .zfproject file?
>
> What I need to end up with is:
>
> ...
> <modelsDirectory>
>    <repositoryDirectory>
>        <repoFile repoName="User" />
>    </repositoryDirectory>
> </modelsDirectory>
> ...
>
> So I need to add the repository node when "zf create repository $name"
> is called, so that I can add the reposFiles inside that directory
> node.
>
> I suppose essentially I want the command to have two contexts one that
> creates the directory node and one that adds the files....
>
> Below is what I have so far:
>
> class Max_Tool_Project_Provider_MaxRepository extends
> Zend_Tool_Project_Provider_Abstract
> {
>    public function getContextClasses()
>    {
>        return array('Max_Tool_Project_Context_RepositoryDirectory');
>    }
>
>    protected static function
> _getRepoDirectoryResource(Zend_Tool_Project_Profile $profile,
> $moduleName = null)
>    {
>        $profileSearchParams = array();
>
>        if ($moduleName != null && is_string($moduleName)) {
>            $profileSearchParams = array('modulesDirectory',
> 'moduleDirectory' => array('moduleName' => $moduleName));
>        }
>
>        $profileSearchParams[] = 'modelsDirectory';
>        $profileSearchParams[] = 'repositoryDirectory';
>
>        return $profile->search($profileSearchParams);
>    }
>
>    public function create($name, $module=null)
>    {
>        $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION);
>
>        var_dump(self::_getRepoDirectoryResource($this->_loadedProfile,
> $module));
>        // create the directory at this point if it is not found???
>    }
> }
>
> class Max_Tool_Project_Context_RepositoryDirectory extends
> Zend_Tool_Project_Context_Filesystem_Directory
> {
>    /**
>     * @var string
>     */
>    protected $_filesystemName = 'Repository';
>
>    /**
>     * getName()
>     *
>     * @return string
>     */
>    public function getName()
>    {
>        return 'RepositoryDirectory';
>    }
>
> }
>
> --
> ------------
> http://www.thepopeisdead.com
>
>

Reply via email to