This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » development » Feature requests » Data Table Descriptor
Data Table Descriptor [message #83296] Thu, 06 August 2009 13:44 Go to next message
Nicolas400  is currently offline Nicolas400
Messages: 27
Registered: August 2009
Location: Necochea, Argentina
Junior Member

This is an Idea that I see on another Generators.

In the schema.yml you could set an attribute as : isDescriptor or Descriptor : true, for a field, and create a __toString() function with the corresponding Getter ...


propel:
  jobeet_category:
    id:           ~
    name:         { type: varchar(255), required: true, index: unique, descriptor:true }


and the function __toString()
could be :
return $this->getName() ;

Sorry if this functionality is acomplish in another way ...
Very Happy
Re: Data Table Descriptor [message #83361 is a reply to message #83296 ] Fri, 07 August 2009 17:51 Go to previous messageGo to next message
Russ  is currently offline Russ
Messages: 413
Registered: August 2008
Location: Oslo, Norway
Faithful Member

It's a nice idea, but you will probably have to suggest it to the ORM guys since it needs to be implemented there.

Doctrine for example guesses if you don't have a __toString() method - in which case for your suggestion to work, this "guessing" would have to be preceded by a check for a "descriptor" field.

$guesses = array('name',
                     'title',
                     'description',
                     'subject',
                     'keywords',
                     'id');


*On Freenode I am rooster*
http://www.walkandclimb.co.uk/images/monkeydust.jpghttp://www.walkandclimb.co.uk/userpix/2_linux_wave_small_2.jpg
Re: Data Table Descriptor [message #83375 is a reply to message #83296 ] Fri, 07 August 2009 18:46 Go to previous messageGo to next message
maker  is currently offline maker
Messages: 36
Registered: June 2009
Location: Poland
Member
its also possible by extending the propel generator class but i doubt that symfony team would be interested in this. The only ORM supported by symfony now is Doctrine.


http://www.sote.pl
Re: Data Table Descriptor [message #83384 is a reply to message #83375 ] Sat, 08 August 2009 01:55 Go to previous messageGo to next message
Russ  is currently offline Russ
Messages: 413
Registered: August 2008
Location: Oslo, Norway
Faithful Member

That's quite a sweeping statement! Whilst Doctrine may become somewhat the default ORM in time, support for Propel will continue for as long as the community wishes it.

Even if the "core team" were to reject a suggestion based on its future merits, there is no reason why a community member couldn't release a plugin or patch to fulfil this request.


*On Freenode I am rooster*
http://www.walkandclimb.co.uk/images/monkeydust.jpghttp://www.walkandclimb.co.uk/userpix/2_linux_wave_small_2.jpg
Re: Data Table Descriptor [message #83388 is a reply to message #83296 ] Sat, 08 August 2009 09:17 Go to previous messageGo to next message
maker  is currently offline maker
Messages: 36
Registered: June 2009
Location: Poland
Member
The community is one thing but look at the propel project I don't want to make any false statements here but the facts are that it's progress has slow down. Fabien has realized earlier this and "switched" to doctrine. Because as he sad the propel and doctrine will be supported as plugins but all the efforts now will be focused on doctrine ORM and in the future this ORM will become the main symfony ORM. I'm using propel now and can't switch to doctrine because this will mean to rewrite the whole project which at this time is impossible. But the next version of our software will be using doctrine and I don't have to write why because it's obvious.


http://www.sote.pl
Re: Data Table Descriptor [message #83497 is a reply to message #83361 ] Mon, 10 August 2009 15:16 Go to previous messageGo to next message
Nicolas400  is currently offline Nicolas400
Messages: 27
Registered: August 2009
Location: Necochea, Argentina
Junior Member

Hi, Russ, i'm moving to Doctrine...
just a question,
where do I have to add my own guesses ??

Is there any config file ?

best regards.
Nicolas
Re: Data Table Descriptor [message #83499 is a reply to message #83497 ] Mon, 10 August 2009 15:27 Go to previous messageGo to next message
Russ  is currently offline Russ
Messages: 413
Registered: August 2008
Location: Oslo, Norway
Faithful Member

Hi Nicolas,

At the moment, the list I posted below is hard coded into Doctrine, so they are the only guesses you will get. If you want something else, you need to use the __toString() method.

It seems like there are two things you can suggest to the Doctrine team, one could be setting the guesses, maybe via the Doctrine configuration settings. Another, could be what you suggested, a way to define a "descriptor" column when you set up a table.

Both of these things would probably be accepted if you (or someone) provided a patch... They may not be too keen to spend time on it though, as the current __toString() implementation does give you a way to achieve this at the moment, so the added value is not huge for them to divert attention from something else.


*On Freenode I am rooster*
http://www.walkandclimb.co.uk/images/monkeydust.jpghttp://www.walkandclimb.co.uk/userpix/2_linux_wave_small_2.jpg
Re: Data Table Descriptor [message #83505 is a reply to message #83499 ] Mon, 10 August 2009 16:23 Go to previous messageGo to next message
Nicolas400  is currently offline Nicolas400
Messages: 27
Registered: August 2009
Location: Necochea, Argentina
Junior Member

Thanks, Russ.

You are right, why to make simplest the simple ..

But, I still have a with Doctrine and index actions.
When I test Propel, I could use

$productos->getLineas($productos->getlineaId)->GetDescripcion()
in the indexSuccess.php template file
so I could see a description and not an ID.

What is the best way to achieve this with Doctrine ??

Best Regards
Re: Data Table Descriptor [message #83506 is a reply to message #83505 ] Mon, 10 August 2009 16:39 Go to previous messageGo to next message
Russ  is currently offline Russ
Messages: 413
Registered: August 2008
Location: Oslo, Norway
Faithful Member

I'm not quite sure I understand, it should be pretty much the same.

http://www.doctrine-project.org/documentation/manual/1_0/en/ working-with-models#dealing-with-relations


*On Freenode I am rooster*
http://www.walkandclimb.co.uk/images/monkeydust.jpghttp://www.walkandclimb.co.uk/userpix/2_linux_wave_small_2.jpg
Re: Data Table Descriptor [message #83516 is a reply to message #83506 ] Mon, 10 August 2009 17:37 Go to previous message
Nicolas400  is currently offline Nicolas400
Messages: 27
Registered: August 2009
Location: Necochea, Argentina
Junior Member

Thanks again

This is what I try to do, finally works, the commented lines were my tries, whit the Propel way ..

<tbody>
    <?php foreach ($productos_list as $productos): ?>
    <tr>
    	
      <td><a href="<?php echo url_for('productos/show?id='.$productos->getId()) ?>"><?php echo $productos->getId() ?></a></td>
      <td><?php echo $productos->getDescripcion() ?></td>
      <!--  $productos->getLineas($productos->getLineaId())->getDescripcion() -->
      <!-- <td><?php echo $productos->getLineas()->$productos->getDescripcion() ?></td> -->
      
      <td><?php echo $productos->Lineas[0]->descripcion ?> </td>
      
      <td><?php echo $productos->getVersion() ?></td>
      <td><?php echo $productos->getAncho() ?></td>
      <td><?php echo $productos->getLargo() ?></td>
      <td><?php echo $productos->getAlto() ?></td>
      <td><?php echo $productos->getPrecio() ?></td>
    </tr>
    <?php endforeach; ?>


Best regards.
Previous Topic:sfpager::getPage();
Next Topic:Manual layout forms
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software