Framework Request / Question

88 views
Skip to the first unread message

Mike.P

unread,
6 Apr 2009, 19:45:5606/04/2009
to Recess PHP Framework
I am looking to add file uploading capability to a controller. Should
I fork you and try to add it into the framework or is there a
preffered way to handle this sort of functionality?

Also I am getting an error when deleting a post which has a HasMany -
BelongsTo relationship? I was able to get the delete to fire in my
scaffolding controller by setting cascade to false but I bet I am
creating orphans?

Here's the error:
Comment has not been imported.

Location: Line 0 of


Fatal error: Cannot redeclare printtype() (previously declared
in C:\wamp\www\RECESS\recess\lib\recess\diagnostics\output
\exception_report.php:2) in C:\wamp\www\RECESS\recess\lib\recess
\diagnostics\output\exception_report.php on line 4

Kris Jordan

unread,
7 Apr 2009, 12:59:2807/04/2009
to recess-f...@googlegroups.com
Mike-

There is not yet an officially recommended way of handling file uploads beyond PHP's built-in constructs. Would love for you to fork the source and take a stab at framework-level integration if you've got some ideas.

As for the problem during deletion, it looks like a problem of a class not having been 'imported' or autoloaded. In models that have relationships you'll want to import the related classes at the top of your file like so:

<?php
Library::import('myAppsDirName.models.Comment');

/** !HasMany comments */
class Post { }
?>

Similarly:
 <?php
Library::import('myAppsDirName.models.Post');

/** !BelongsTo post */
class Comment {}
?>

Hope this helps - ping again if you're still running into issues!

Kris

Mike.P

unread,
7 Apr 2009, 13:53:5407/04/2009
to Recess PHP Framework
I actually attempted adding another form class called FileInput but
was
having issues figuring out everywhere it should be referenced, looks
like
you are declaring them statically. I tried adding it on so that it
was
available to me as Recess Type when creating a new app form tools,
but it
totally fouled up. I also added another function to the form class
under
begin for enctype of multipart for files, or would it be best to add
it to
the original function with a variable? If you could help me out with
how to
go about adding another form type of File I think I could figure the
rest
out. I actually had it working by hijacking the $_FILES global before
saving
the model data back to the database, performing my upload there, and
then
passing the new filename back before save. But I realise this needs
to be
included in the core. If you want I can send you what I did, or I may
mess
with gitHub tonight.


On Apr 7, 9:59 am, Kris Jordan <krisjor...@gmail.com> wrote:
> Mike-
> There is not yet an officially recommended way of handling file uploads
> beyond PHP's built-in constructs. Would love for you to fork the source and
> take a stab at framework-level integration if you've got some ideas.
>
> As for the problem during deletion, it looks like a problem of a class not
> having been 'imported' or autoloaded. In models that have relationships
> you'll want to import the related classes at the top of your file like so:
>
> <?php
> Library::import('myAppsDirName.models.Comment');
>
> /** !HasMany comments */
> class Post { }
> ?>
>
> Similarly:
>  <?php
> Library::import('myAppsDirName.models.Post');
>
> /** !BelongsTo post */
> class Comment {}
> ?>
>
> Hope this helps - ping again if you're still running into issues!
>
> Kris
>
Reply all
Reply to author
Forward
0 new messages