Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-28 Thread Stanislav Malyshev
The problem still remains that you can't call a derived classes static 
method in the base class.


Static calls are called "static" for a reason - class names are 
resolved... well, statically :) - meaning, in compile time. E.g., "self" 
means "the class I'm currently in". Since there's no object, there's no 
vehicle to contain information like "no, I did't really mean 
ActiveRecord, I meant some other class derived from ActiveRecord" when 
you call a static method. There's simply no place - at least currently 
with PHP 5.x - which could carry such information. To fix it would mean 
to create such a place - some kind of hidden "this class" parameter or 
something else of this form.




Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-28 Thread Justin Hendrickson
The problem still remains that you can't call a derived classes static method in the base class.abstract class ActiveRecord {    abstract static public function getTable();    static public function find() {
    echo self::getTable();    }}class Person extends ActiveRecord {    static public function getTable() {    return __CLASS__;    }}Person::find();Fatal error: Cannot call abstract method ActiveRecord::getTable() in /home/jhendric/test.php on line 7
Call Stack:    0.0004  40688   1. {main}() /home/jhendric/test.php:0    0.0005  40688   2. ActiveRecord::find() /home/jhendric/test.php:20On 9/28/06, 
Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:
-- Davey Shafik <[EMAIL PROTECTED]> wrote(on Thursday, 28 September 2006, 10:20 AM -0400):> And that'll teach me to jump in on a conversation :)>> What about implementing an interface which specifies a getTable()
> method, then don't implement it in an Abstract AR class.>> That way when you extend, you write in a:>> function getTable()> {>   return __CLASS__;> }>
> or you can even do:>> function getTable()> {>   return "Somethingcompletelydifferent";> }>> I dislike this idea, I prefer just to instantiate the AR class and
> use it as an object :)This type of solution was discussed at one point. I believe it wasrejected because many felt it added what could be construed as one steptoo many in development. Instead of simply:
class MyTable extends Zend_Db_Table {}the developer now has to do:class MyTable extends Zend_Db_Table{public static function getTable(){return __CLASS__;
}}Admittedly not a lot of code, but it's another vector for introducingerrors.I'm not exactly sure where my own preference lies, personally.> On Sep 28, 2006, at 10:03 AM, Pavel Shevaev wrote:
>> > On 9/28/06, Davey Shafik <[EMAIL PROTECTED]> wrote:> > > Uh> > >> > > __CLASS__> > >
> >> > Not really, here's how it all started> > http://www.sitepoint.com/forums/showthread.php?t=334377--Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]Zend - The PHP Company   | http://www.zend.com/


Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-28 Thread Dale McNeill




How would a change to the View require a change to the validation? 
Ideally, the View should be completely separate from business logic
(Controller & Model).  A change to the View should have no effect
on the validation of the form elements.

I can fully appreciate the debate between putting data validation
within the Model or Controller.    The use cases against putting
validation in the Model are incoming data does not always flow to the
Model and data flowing to the Model does not always need to be
validated. IMO, the validation needs to be its own object instantiated
in the Controller
because it shares its duties between validating the incoming data and
alerting the View to validation errors.

I guess the majority of this debate comes down to how you design the
form, the validation of the form, how the validation communicates to
the View, and retrieval and/or storage of data from the form. My system
is a lot like what Michael Minicki described on the Zend_Form proposal
which has molded my opinions on this subject:
http://framework.zend.com/wiki/display/ZFPROP/Zend_Form?rootCommentId=3957#comments

Dale

Jean-Baptiste HUNTZINGER wrote:

  
>> MO, data validation should not be performed within the model
but rather in the controller
There is definitively many opinions about Validation in MVC, but I
still don't agree with your statement. I want a solution that does not
oblige me to rewrite my validation code each time my View changes -
either I change the UI logic or the client technology -, since
controller is tighly bound to the view.
Model has all the info needed to performs the validation, and
validation is purely domain logic, no ?
  
Dale McNeill a écrit :
  IMO,
data validation should not be performed within the model but rather in
the controller.  The controller could query the Table/Row for validator
objects but its the controller that should perform all the validating
of data. 

One thing that I would like to see in a future Zend_Db_Table is the
storage of the entire "describe " rather than only storing
the column names.  Why? Well I've changed the Table to store this
information so that the controller can query the Table for the
fundamental validator objects.  A "varchar(30)" can provide a validator
that restricts the the length to 30 characters; a "int(10)" can provide
an integer validator that restricts the maximum value to a 10 digit
signed integer.  I think in general the results of the describe table
is very useful and certainly worth storing all the information.  It
could even be used to set the default values of any unset columns when
performing an insert. 

Dale 

Stuardo -StR- Rodríguez wrote: 
On Wednesday 27 September 2006 00:47,
Victor
Bolshov wrote: 
 
  Could you please tell in more detail -
what
you mean by "a model in MVC"? 
    
  
I mean a model, in the context of Model-View-Controller. As you can see
in http://en.wikipedia.org/wiki/Model-view-controller
  
 
Model: The domain-specific representation of the information on which
the application operates. The model is another name for the domain
layer. Domain logic adds meaning to raw data (e.g., calculating if
today is the user's birthday, or the totals, taxes and shipping charges
for shopping cart items). 
 
  
So.. from where I see.. the controller should create a model to get
data or to return data, from wherever you want (DB, XML, RPC, log,
etc). The controller should know "the action" what should be done, the
bussiness logic. The model should know what to do with the data,
validate the data, and all what is related with data. 
  
Now, I do not see any solution for that in ZF and I thought
Zend_Db_Table could be use as a solution, but I was wrong and I started
the post to see if anyone had the same idea and if anyone has solved
that. 
  
I said "Model in MVC" to let people understand the context, so no one
gets confused with "a model/guide to follow" or "a hot-long-legs-model"
  
  
  
  
  
  
  
  -- 
  Jean-Baptiste HUNTZINGER
  





Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-28 Thread Jean-Baptiste HUNTZINGER




>> MO, data validation should not be performed within the model
but rather in the controller
There is definitively many opinions about Validation in MVC, but I
still don't agree with your statement. I want a solution that does not
oblige me to rewrite my validation code each time my View changes -
either I change the UI logic or the client technology -, since
controller is tighly bound to the view.
Model has all the info needed to performs the validation, and
validation is purely domain logic, no ?

Dale McNeill a écrit :
IMO,
data validation should not be performed within the model but rather in
the controller.  The controller could query the Table/Row for validator
objects but its the controller that should perform all the validating
of data.
  
  
One thing that I would like to see in a future Zend_Db_Table is the
storage of the entire "describe " rather than only storing
the column names.  Why? Well I've changed the Table to store this
information so that the controller can query the Table for the
fundamental validator objects.  A "varchar(30)" can provide a validator
that restricts the the length to 30 characters; a "int(10)" can provide
an integer validator that restricts the maximum value to a 10 digit
signed integer.  I think in general the results of the describe table
is very useful and certainly worth storing all the information.  It
could even be used to set the default values of any unset columns when
performing an insert.
  
  
Dale
  
  
Stuardo -StR- Rodríguez wrote:
  
  On Wednesday 27 September 2006 00:47, Victor
Bolshov wrote:

 
Could you please tell in more detail - what
you mean by "a model in MVC"?
  
    

I mean a model, in the context of Model-View-Controller. As you can see
in http://en.wikipedia.org/wiki/Model-view-controller 


Model: The domain-specific representation of the information on which
the application operates. The model is another name for the domain
layer. Domain logic adds meaning to raw data (e.g., calculating if
today is the user's birthday, or the totals, taxes and shipping charges
for shopping cart items).




So.. from where I see.. the controller should create a model to get
data or to return data, from wherever you want (DB, XML, RPC, log,
etc). The controller should know "the action" what should be done, the
bussiness logic. The model should know what to do with the data,
validate the data, and all what is related with data.


Now, I do not see any solution for that in ZF and I thought
Zend_Db_Table could be use as a solution, but I was wrong and I started
the post to see if anyone had the same idea and if anyone has solved
that.


I said "Model in MVC" to let people understand the context, so no one
gets confused with "a model/guide to follow" or "a hot-long-legs-model"




  


-- 
Jean-Baptiste HUNTZINGER





Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-28 Thread Dale McNeill
IMO, data validation should not be performed within the model but rather 
in the controller.  The controller could query the Table/Row for 
validator objects but its the controller that should perform all the 
validating of data.


One thing that I would like to see in a future Zend_Db_Table is the 
storage of the entire "describe " rather than only storing the 
column names.  Why? Well I've changed the Table to store this 
information so that the controller can query the Table for the 
fundamental validator objects.  A "varchar(30)" can provide a validator 
that restricts the the length to 30 characters; a "int(10)" can provide 
an integer validator that restricts the maximum value to a 10 digit 
signed integer.  I think in general the results of the describe table is 
very useful and certainly worth storing all the information.  It could 
even be used to set the default values of any unset columns when 
performing an insert.


Dale

Stuardo -StR- Rodríguez wrote:

On Wednesday 27 September 2006 00:47, Victor Bolshov wrote:
  

Could you please tell in more detail - what you mean by "a model in MVC"?



I mean a model, in the context of Model-View-Controller. As you can see in 
http://en.wikipedia.org/wiki/Model-view-controller 



Model: The domain-specific representation of the information on which the 
application operates. The model is another name for the domain layer. Domain 
logic adds meaning to raw data (e.g., calculating if today is the user's 
birthday, or the totals, taxes and shipping charges for shopping cart items).



So.. from where I see.. the controller should create a model to get data or to 
return data, from wherever you want (DB, XML, RPC, log, etc). The controller 
should know "the action" what should be done, the bussiness logic. The model 
should know what to do with the data, validate the data, and all what is 
related with data.


Now, I do not see any solution for that in ZF and I thought Zend_Db_Table 
could be use as a solution, but I was wrong and I started the post to see if 
anyone had the same idea and if anyone has solved that.


I said "Model in MVC" to let people understand the context, so no one gets 
confused with "a model/guide to follow" or "a hot-long-legs-model"




  


Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-28 Thread Daniel Kipp

> Basically, this is impossibility (in PHP) to get the class name inside
> of a static method

hi all

I don't know if this was already mentioned but the php developers agreed 
on changing

that behavior in the future versions. (there called it: late static binding)
here is the thread in there mailing list:

http://marc.theaimsgroup.com/?t=11418520931&r=1&w=2

and this is the blog entry of a developer who looks like he is involved.
http://www.digitalsandwich.com/archives/53-Late-Static-Binding-in-PHP.html




Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-28 Thread Matthew Weier O'Phinney
-- Davey Shafik <[EMAIL PROTECTED]> wrote
(on Thursday, 28 September 2006, 10:20 AM -0400):
> And that'll teach me to jump in on a conversation :)
> 
> What about implementing an interface which specifies a getTable()  
> method, then don't implement it in an Abstract AR class.
> 
> That way when you extend, you write in a:
> 
> function getTable()
> {
>   return __CLASS__;
> }
> 
> or you can even do:
> 
> function getTable()
> {
>   return "Somethingcompletelydifferent";
> }
> 
> I dislike this idea, I prefer just to instantiate the AR class and  
> use it as an object :)

This type of solution was discussed at one point. I believe it was
rejected because many felt it added what could be construed as one step
too many in development. Instead of simply:

class MyTable extends Zend_Db_Table {}

the developer now has to do:

class MyTable extends Zend_Db_Table 
{
public static function getTable()
{
return __CLASS__;
}
}

Admittedly not a lot of code, but it's another vector for introducing
errors.

I'm not exactly sure where my own preference lies, personally.

> On Sep 28, 2006, at 10:03 AM, Pavel Shevaev wrote:
> 
> > On 9/28/06, Davey Shafik <[EMAIL PROTECTED]> wrote:
> > > Uh
> > >
> > > __CLASS__
> > >
> >
> > Not really, here's how it all started
> > http://www.sitepoint.com/forums/showthread.php?t=334377

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-28 Thread Davey Shafik

And that'll teach me to jump in on a conversation :)

What about implementing an interface which specifies a getTable()  
method, then don't implement it in an Abstract AR class.


That way when you extend, you write in a:

function getTable()
{
return __CLASS__;
}

or you can even do:

function getTable()
{
return "Somethingcompletelydifferent";
}

I dislike this idea, I prefer just to instantiate the AR class and  
use it as an object :)


- Davey

On Sep 28, 2006, at 10:03 AM, Pavel Shevaev wrote:


On 9/28/06, Davey Shafik <[EMAIL PROTECTED]> wrote:

Uh

__CLASS__



Not really, here's how it all started
http://www.sitepoint.com/forums/showthread.php?t=334377


- Davey

--
Best regards, Pavel
--
LIMB - http://limb-project.com
Bureau of Information Technologies - http://www.bit-creative.com





Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-28 Thread Davey Shafik

Uh

__CLASS__

- Davey


On Sep 28, 2006, at 4:17 AM, Pavel Shevaev wrote:

Basically, this is impossibility (in PHP) to get the class name  
inside

of a static method


Yes, i can second that, it's one of the biggest obstacles in the way
of making model finder calls more "developer friendly". This is what
we're currently using: lmbActiveRecord :: find('News', ...) instead of
simply calling News :: find(...)

--
Best regards, Pavel
--
LIMB - http://limb-project.com
Bureau of Information Technologies - http://www.bit-creative.com





Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-28 Thread Pavel Shevaev

On 9/28/06, Davey Shafik <[EMAIL PROTECTED]> wrote:

Uh

__CLASS__



Not really, here's how it all started
http://www.sitepoint.com/forums/showthread.php?t=334377


- Davey

--
Best regards, Pavel
--
LIMB - http://limb-project.com
Bureau of Information Technologies - http://www.bit-creative.com


Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-28 Thread Pavel Shevaev

Basically, this is impossibility (in PHP) to get the class name inside
of a static method


Yes, i can second that, it's one of the biggest obstacles in the way
of making model finder calls more "developer friendly". This is what
we're currently using: lmbActiveRecord :: find('News', ...) instead of
simply calling News :: find(...)

--
Best regards, Pavel
--
LIMB - http://limb-project.com
Bureau of Information Technologies - http://www.bit-creative.com


Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-27 Thread Stuardo -StR- Rodríguez
On Wednesday 27 September 2006 05:08, Michael Yevdokimov wrote:
> I am curious what others do with the missing Model Controller??

Me too..  I saw in the "IBM ZendFramework Tutorial" they do not use Models, 
they have the data validation, and all what should be in the model, inside 
the controller.  This is something I do not like because they mix a lot of 
code together.

Do you now have an abstract class for your own Model? Could you share it with 
me?

I will send what I have in my next mail (got to organize it and make some 
documentation for it)

-- 
Stuardo -StR- Rodríguez
.-[Just me and the world I created]-.
email: [EMAIL PROTECTED]
www: http://strgt.cjb.net
phpgt: http://php.develsystems.com


Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-27 Thread Stuardo -StR- Rodríguez
On Wednesday 27 September 2006 00:47, Victor Bolshov wrote:
> Could you please tell in more detail - what you mean by "a model in MVC"?

I mean a model, in the context of Model-View-Controller. As you can see in 
http://en.wikipedia.org/wiki/Model-view-controller 


Model: The domain-specific representation of the information on which the 
application operates. The model is another name for the domain layer. Domain 
logic adds meaning to raw data (e.g., calculating if today is the user's 
birthday, or the totals, taxes and shipping charges for shopping cart items).


So.. from where I see.. the controller should create a model to get data or to 
return data, from wherever you want (DB, XML, RPC, log, etc). The controller 
should know "the action" what should be done, the bussiness logic. The model 
should know what to do with the data, validate the data, and all what is 
related with data.

Now, I do not see any solution for that in ZF and I thought Zend_Db_Table 
could be use as a solution, but I was wrong and I started the post to see if 
anyone had the same idea and if anyone has solved that.

I said "Model in MVC" to let people understand the context, so no one gets 
confused with "a model/guide to follow" or "a hot-long-legs-model"



-- 
Stuardo -StR- Rodríguez
.-[Just me and the world I created]-.
email: [EMAIL PROTECTED]
www: http://strgt.cjb.net
phpgt: http://php.develsystems.com


RE: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-27 Thread Kucera, Rich
> I am curious what others do with the missing Model Controller?? ;)

Controller:  "dumping ground for miscellaneous stuff"
http://lua-users.org/lists/lua-l/2006-08/msg00513.html

Controllers written by apps developers tend to be idiosyncratic (it's uh,
heh, all in one JSP file,  or,  it's here in these 57 XML files, or something
like that),  anybody off the street would probably just rewrite it or if they
had any sense generate it,  rather than try to understand it...so
controller-writing is essentially a waste of time for application developers.
Something standard ought to be in ZF that can't easily be rewritten and that
actually performs some service like,  generates all your dropdowns or
something,  like Achievo TK.

Trying to get ahead of the curve with Achievo TK now...nobody would have a
chance of rewriting that,  and it actually scales up to the 30 page business
apps with the 27 wired dropdowns and other widgets.  I don't know if you can
say the same about RoR.  Table-driven,  yes. They know SQL.  ATK is something
on the order of Oracle Forms,  or Sledgehammer,  er what was that
called?...oh yeah, IronSpeed.

-R



Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-27 Thread Victor Bolshov

Michael Yevdokimov wrote:

Hi again
This is all interesting. So basically you mean that there can not be
no such a term in MVC for PHP, like there is for ROR? I am curious
what you think about Propel as a tool to 'emulate' models in php mvc?
Though I would still agree that this is again just an ORM and not more
than that.


I just say that the *implementation* and the following *usage* of 
ROR-like models will definitely differ in PHP from that of Ruby.



To be honest, I do not use any of these ORM things. I am still making
SQL queries myself or with some visual software.


So? ZF is offering you great functionality, which will help you reduce 
the amount of code in your applications.



I created my own 'model controller' with the methods like insert,
delete, etc. which actually just creating queries which are being sent
later to ADODB php library. so from this 'model controller' I inherit
all my models.

Otherwise, I think there will be too much mass in my code.


This reminds me something. I think I have seen that... ah, sure. I've 
seen that in ZF ;) (ok, almost every PHP-framework offers some sort of 
decision for thise kind of problems)



I am curious what others do with the missing Model Controller?? ;)


Personally, I usually have two kinds of models: one for DB tables/rows, 
and another for *domain/business* logic/relations. And I can say that 
there are situations when Domain Model acts as a controller (or at least 
we can say so).



Cheers,
Mikhail





smime.p7s
Description: S/MIME Cryptographic Signature


Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-27 Thread Victor Bolshov

Markus Wolff wrote:

Victor Bolshov schrieb:
One cannot simply port Rails-ActiveRecord to PHP (there are certain 
features used that are not yet implemented in PHP, possibly will be in 
PHP6).


Hi Victor,

Just out of curiosity: What features do you think these are?

CU
 Markus



Basically, this is impossibility (in PHP) to get the class name inside 
of a static method:


class A {
static function func(){}
}

class B extends A {

}

B::func();// inside the func() method we *cannot* know that the caller 
is class 'B'. It is *alwayse* 'A'.


Thus, the ROR approach (table methods are class methods, while row 
methods are instance methods) is unreachable.


Regards,

Victor


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-27 Thread Michael Yevdokimov

Hi again
This is all interesting. So basically you mean that there can not be
no such a term in MVC for PHP, like there is for ROR? I am curious
what you think about Propel as a tool to 'emulate' models in php mvc?
Though I would still agree that this is again just an ORM and not more
than that.

To be honest, I do not use any of these ORM things. I am still making
SQL queries myself or with some visual software.

I created my own 'model controller' with the methods like insert,
delete, etc. which actually just creating queries which are being sent
later to ADODB php library. so from this 'model controller' I inherit
all my models.

Otherwise, I think there will be too much mass in my code.

I am curious what others do with the missing Model Controller?? ;)

Cheers,
Mikhail


On 9/27/06, Victor Bolshov <[EMAIL PROTECTED]> wrote:

Michael Yevdokimov wrote:
> Hello Victor,
>
> Could you please explain what the Model should be or how it should be
> presented in ZF in your opinion?
> Example is simple: I would like to use the model the same way as I do it
> in Rails, i.e. putting all the database manipulations and data
> validation into it.
>
> Thank you very much in advance.
>

One cannot simply port Rails-ActiveRecord to PHP (there are certain
features used that are not yet implemented in PHP, possibly will be in
PHP6).

In *my* opinion, a model, indeed, should look like that of Rails. In
LIMB-project ( http://limb-project.com ) they've recently have made a
step towards making their model much like Rails' one. You may also take
look at php-doctrine.

But the *original* question was about "a model in MVC". To me, it looks
like a senseless set of words. In MVC you are free to use any kind of
model. Zend_Db_* does *NOT* provide you with an ActiveRecord, nor does
it provide a means for validation and object-relational mapping. It is
*just* what it is: a DBAL, a query-object, a Table-gateway and a
Row-gateway. You may use it your application, and your application is
free to acquire MVC architecture or some other architecture as well.

Although there is sometimes a need for an advanced ORM in an
application, the means provided by Zend_Db_*, should, as I believe,
satisfy developer in 80-90% of cases. And, there is a strong doubt that
a large-and-heavy ORM tool could really solve all the problems regarding
application-RDBMS relation.

Regards,

Victor.

PS. The question you have asked (if before we refer to the original
question), should not be "what the Model should be or how it should be
presented in *ZF* in your opinion?" - but instead "what the Model should
be or how it should be presented in *MVC* in your opinion?". I cannot
answer this question, and think nobody can.





--
Michael Yevdokimov
E-mail: [EMAIL PROTECTED]
Tel. +31 (0) 61 4599307


Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-27 Thread Markus Wolff

Victor Bolshov schrieb:
One cannot simply port Rails-ActiveRecord to PHP (there are certain 
features used that are not yet implemented in PHP, possibly will be in 
PHP6).


Hi Victor,

Just out of curiosity: What features do you think these are?

CU
 Markus


Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-27 Thread Victor Bolshov

Michael Yevdokimov wrote:

Hello Victor,
 
Could you please explain what the Model should be or how it should be 
presented in ZF in your opinion?
Example is simple: I would like to use the model the same way as I do it 
in Rails, i.e. putting all the database manipulations and data 
validation into it.
 
Thank you very much in advance.
 


One cannot simply port Rails-ActiveRecord to PHP (there are certain 
features used that are not yet implemented in PHP, possibly will be in 
PHP6).


In *my* opinion, a model, indeed, should look like that of Rails. In 
LIMB-project ( http://limb-project.com ) they've recently have made a 
step towards making their model much like Rails' one. You may also take 
look at php-doctrine.


But the *original* question was about "a model in MVC". To me, it looks 
like a senseless set of words. In MVC you are free to use any kind of 
model. Zend_Db_* does *NOT* provide you with an ActiveRecord, nor does 
it provide a means for validation and object-relational mapping. It is 
*just* what it is: a DBAL, a query-object, a Table-gateway and a 
Row-gateway. You may use it your application, and your application is 
free to acquire MVC architecture or some other architecture as well.


Although there is sometimes a need for an advanced ORM in an 
application, the means provided by Zend_Db_*, should, as I believe, 
satisfy developer in 80-90% of cases. And, there is a strong doubt that 
a large-and-heavy ORM tool could really solve all the problems regarding 
application-RDBMS relation.


Regards,

Victor.

PS. The question you have asked (if before we refer to the original 
question), should not be "what the Model should be or how it should be 
presented in *ZF* in your opinion?" - but instead "what the Model should 
be or how it should be presented in *MVC* in your opinion?". I cannot 
answer this question, and think nobody can.


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-27 Thread Michael Yevdokimov
Hello Victor,
 
Could you please explain what the Model should be or how it should be presented in ZF in your opinion?
Example is simple: I would like to use the model the same way as I do it in Rails, i.e. putting all the database manipulations and data validation into it.
 
Thank you very much in advance.
 
 
On 9/27/06, Victor Bolshov <[EMAIL PROTECTED]> wrote:
Could you please tell in more detail - what you mean by "a model in MVC"?

-- Michael YevdokimovE-mail: [EMAIL PROTECTED]Tel. +31 (0) 61 4599307
 
P.S. Privet iz Gollandii! :) 


Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-26 Thread Victor Bolshov

Could you please tell in more detail - what you mean by "a model in MVC"?


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-26 Thread Michael Sheakoski
Did you mean $page->insert($data); maybe?  I haven't worked much with 
Zend_Db_Table yet but that looked like a possible reason why it was not 
giving the expected result.



Stuardo -StR- Rodríguez wrote:

I thought I could Just do something like:

$page = new BizMS_Model_Page();
$data = array ('title' => 'My title', 'content' => $content);
$page->insert($page);


[fw-general] Zend_Db_Table is not a base for a model in MVC

2006-09-26 Thread Stuardo -StR- Rodríguez

I thought I could use Zend_Db_Table as a class to be extended so I could use 
them as a Model in MVC

here is some part of my code:

class BizMS_Model_Page  extends Zend_Db_Table {
protected $_name = 'bizms_page';
protected static $_tableName = 'bizms_page';


public function __construct($id = NULL){
parent::__construct();
if ($id && is_int($id) && $id > 0) {
$this->_data =  $this->find($id)->toArray();
}
}
// [...]
}


I thought I could Just do something like:

$page = new BizMS_Model_Page();
$data = array ('title' => 'My title', 'content' => $content);
$page->insert($page);

wich I can.. and it seems like it is a Model from MVC

So the next thing I would like to do is to create a new Page:

$page =  new BizMS_Model_Page($id);

To do this, I had to overload my "model"  with the code above, but then I 
can't call 

$page->title

Is there a how-to create Models from MVC with ZF?

Thanks





-- 
Stuardo -StR- Rodríguez
.-[Just me and the world I created]-.
email: [EMAIL PROTECTED]
www: http://strgt.cjb.net
phpgt: http://php.develsystems.com