Search Results

Search found 564 results on 23 pages for 'symfony 2 1'.

Page 17/23 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • how to give 2 parameters to remote_function thanks to 'with' ???

    - by bahamut100
    Hi, I try to give a lot of parameters in a remote_function like this : <?php echo remote_function(array( 'update' => 'test', 'url' => 'conges/verifdate', 'with' => "'date_deb=' + $('date_debut').value" )); ?> This code works, in my action.class I can to get the parameter. But when I try to give a second parameter, it doesn't work : <?php echo remote_function(array( 'update' => 'test', 'url' => 'conges/verifdate', 'with' => "'date_deb=' + $('date_debut').value"."'+&date_fin=' + $('date_fin')" )) ?> Why ??

    Read the article

  • displaying values from join query array

    - by THOmas
    I have used a join query for retrieving value from two tables one is blogquestion and userdetails I wrote this query $this->questions = Doctrine_Query::create() ->select('b.question_id,b.user_id,b.question_title,b.question_tags,b.created_at,u.id,u.name') ->from('BlogQuestion b') ->leftJoin('b.UserDetails u') ->execute(); In the template iam displaying the result using a foreach <?php foreach($questions as $quest):?> echo $quest->getQuestionTitle() echo $quest->getQuestionTags() echo $quest->getName() <?php endforeach?> title is getting from the blogquestion table and name is in usredetails table iam getting the eerror Unknown record property / related component "name" on "BlogQuestion"

    Read the article

  • Symfony2 Setting a default choice field selection

    - by Mat
    I am creating a form in the following manner: $form = $this->createFormBuilder($breed) ->add('species', 'entity', array( 'class' => 'BFPEduBundle:Item', 'property' => 'name', 'query_builder' => function(ItemRepository $er){ return $er->createQueryBuilder('i') ->where("i.type = 'species'") ->orderBy('i.name', 'ASC'); })) ->add('breed', 'text', array('required'=>true)) ->add('size', 'textarea', array('required' => false)) ->getForm() How can I set a default value for the species listbox? Thank you for your response, I apologise, I think I should rephrase my question. Once I have a value that I retrieve from the model, how do I set that value as SELECTED="yes" for the corresponding value in the species choice list? So, that select option output from the TWIG view would appear like so: <option value="174" selected="yes">Dog</option>

    Read the article

  • sfDoctrineGuard - how to ALWAYS join sfGuardProfile to sfGuardUser

    - by prodigitalson
    I want to make it so that anytime the db is queried for an sfGuardUserProfile it is autmoatically joined and hydrated with its related sfGuardUser. If i was using propel i would normally override the doSelectStmt method of the sfGuardUserProfilePeer class to inspect the Criteria and modify it as necessary as well as modifying the hydrate method of the sfGuardUserProfile class. Im not sure how to go about doing this in Doctrine though.

    Read the article

  • Doctrine: Update Join?

    - by Tom
    Hi, Anyone know how to do an update with a join (i.e. update on two tables in one query) in Doctrine 1.2? I spotted something obscure on a forum that hinted that this is not supported in 1.x but it was about as vague as it comes. Thank you.

    Read the article

  • Subquery Doctrine Couldn't find class

    - by yosesita
    I'm trying to create a query like this one : $q = Doctrine_Query::create() -select('p.nombre') -addSelect('(select count(*) from alojamiento a left join localidad l on a.localidad_id=l.id where p.id=l.provincia_id and a.activo=true)') -from('provincia p'); but it fails : error 500, couldn't find class a. And : $q = Doctrine_Query::create() -select('nombre') -addSelect('(select count(*) from alojamiento left join localidad on alojamiento.localidad_id=localidad.id where provincia.id=localidad.provincia_id and alojamiento.activo=true)') -from('provincia'); leads to : SQLSTATE[42S22]: Column not found: 1054 Unknown column 'a.localidad_id' in 'on clause'. Any help would be greatly appreciated !

    Read the article

  • Get object from arraycollection

    - by Nll
    I have a problem about to get an object from arraycollection of objects with Id,so I do : protected $_rootObject; public function __construct(myClasse $rootObject) { $this->_rootObject= $rootObject; } public function getObjectById($id) { $value = null; foreach($this->_rootObject as $root) { if ($id == $root->getId()) { $value = $root; break; } } return $value; } Then the function return "NULL" so it's dosn't work...

    Read the article

  • Using virtual fields in Doctrine_Query

    - by James Maroney
    Is there a way to insert logic based on virtual fields into a Doctrine_Query? I have defined a virtual field in my model, "getStatus()" which I would ultimately like to utilize in a Where clause in my Doctrine_Query. ... ->AndWhere('x.status = ?',$status); "status", however, is not a column in the table it is instead computed by business logic in the model. Filtering the Collection after executing the query works in some situations, but not when a Doctrine_Pager is thrown in the mix, as it computes it's offsets and such before you have access to the Collection. Am I best off ditching Doctrine_Pager and rebuilding that functionality after modifying the Doctrine_Collection?

    Read the article

  • Selecting date NOT NULL records between a specific range with Propel

    - by Jon Winstanley
    Using Propel I would like to find records which have a date field which is not null and also between a specific range. However, Propel seems to overwrite the criteria with the NOTNULL criteria. Is it possible to do this? //create the date ranges $start_date = mktime(0, 0, 0, date("m") , date("d")+$start, date("Y")); $end_date = mktime(0, 0, 0, date("m") , date("d")+$end, date("Y")); //add the start of the range $c1 = $c->getNewCriterion(TaskPeer::DUE_DATE, null); $c1->addAnd($c->getNewCriterion(TaskPeer::DUE_DATE, $end_date, Criteria::LESS_EQUAL)); $c->add($c1); //add the end of the range $c2 = $c->getNewCriterion(TaskPeer::DUE_DATE, null); $c2->addAnd($c->getNewCriterion(TaskPeer::DUE_DATE, $start_date, Criteria::GREATER_EQUAL)); $c->add($c2); //remove the null entries $c3 = $c->getNewCriterion(TaskPeer::DUE_DATE, null); $c3->addAnd($c->getNewCriterion(TaskPeer::DUE_DATE, null, Criteria::ISNULL)); $c->add($c3);

    Read the article

  • PropelBundle database:create for postgres

    - by Karol85
    I've installed propel bundle for symfony2. my database configuration is: propel: dbal: driver: pgsql user: postgres password: postgres dsn: pgsql:host=localhost;port=5432;dbname=test_database options: {} attributes: {} When i wan to create this database from console (console propel: database:create) i have got strange error : Unable to open PDO connection [wrapped: SQLSTATE[08006] [7] FATAL: database "pgsql" does not exist. i created pgsql database on my localhost and everything was good. Database "test_database" was succesfull created. Can somebody explain me why i got this previous error? On mysql i've created database without any problems.

    Read the article

  • How to do a join with ttwo tables ??

    - by bahamut100
    HI, I try to translate this query : SELECT * FROM `reunion` , lieu WHERE reunion.lieu_reunion = lieu.id_lieu to propel query : $c=new Criteria(); $c->addJoin(ReunionPeer::LIEU_REUNION,LieuPeer::ID_LIEU, Criteria::LEFT_JOIN); $this->reunions = ReunionPeer::doSelect($c); But in my template, when I made a print_r($reunions), the field "ville" (from the table 'lieu') is not present. Why ??

    Read the article

  • Setting ownership/permissions for symfony2 and other web projects

    - by Handonam
    I've been very confused as to how to set permissions and user/groups for my sites. It is particularly one of my weakest suits My curent problem is that I often find myself running into a situation where if i view a particular page, it won't have permissions to write to cache or logs. At this point I'll set the ownership towards apache. Then, in other cases, if i try to run internal scripts, for example, I can't write to these cache/log files because i set them for apache. Currently, my symfony2 files are all registered to me as a part of staff (Handonam:Staff). I've seen various people creating groups such as www-data, apache, etc, and using users such as theirselves (e.g. Handonam) or www as a part of those groups. So my question is: For symfony2 and other web projects, what's generally the best setup for user/group setup so that both apache and myself can interact with these files, while maintaining decent security?

    Read the article

  • Symfony2 Forms: is it possible to bind a form in an "unconventional way"?

    - by DonCallisto
    Imagine this scenario: in our company there is an employee that "play" around graphic,css,html and so on. Our new project will born under symfony2 so we're trying some silly - but "real" - stuff (like authentication from db, submit data from a form and persist it to db and so on..) The problem As far i know, learnt from symfony2 "book" that i found on the site (you can find it here), there is an "automated" way for creating and rendering forms: 1) Build the form up into a controller in this way $form = $this->createFormBuilder($task) ->add('task','text'), ->add('dueDate','date'), ->getForm(); return $this->render('pathToBundle:Controller:templateTwig', array('form'=>$form->createview()); 2) Into templateTwig render the template {{ form_widget(form) }} // or single rows method 3) Into a controller (the same that have a route where you can submit data), take back submitted information if($rquest->getMethod()=='POST'){ $form->bindRequest($request); /* and so on */ } Return to scenario Our graphic employee don't want to access controllers, write php and other stuff like those. So he'll write a twig template with a "unconventional" (from symfony2 point of view, but conventional from HTML point of view) method: /* into twig template */ <form action="{{ path('SestanteUserBundle_homepage') }}" method="post" name="userForm"> <div> USERNAME: <input type="text" name="user_name" value="{{ user.username}}"/> </div> <div> EMAIL: <input type="text" name="user_mail" value="{{ user.email }}"/> </div> <input type="hidden" name="user_id" value="{{ id }}" /> <input type="submit" value="modifica i dati"> </form> Now, if into the controller that handle the submission of data we do something like that public function indexAction(Request $request) { if($request->getMethod() == 'POST'){ // sono arrivato per via di un submit, quindi devo modificare i dati prima di farli vedere a video $defaultData = array('message'=>'ho visto questa cosa in esempio, ma non capisco se posso farne a meno'); $form = $this->createFormBuilder($defaultData) ->add('user_name','text') ->add('user_mail','email') ->add('user_id','integer') ->getForm(); $form->bindRequest($request); //bindo la form ad una request $data = $form->getData(); //mi aspetto un'array chiave=>valore /* .... */ We expected that $data will contain an array with key,value from the submitted form. We found that it isn't true. After googling for a while and try with other "bad" ideas, we're frozen into that. So, if you have a "graphic office" that can't handle directly php code, how can we interface from form(s) to controller(s) ? UPDATE It seems that Symfony2 use a different convention for form's field name and lookup once you've submitted that. In particular, if my form's name is addUser and a field is named userName, the field's name will be AddUser[username] so maybe it have a "dynamic" lookup method that will extract form's name, field's name, concat them and lookup for values. Is it possible?

    Read the article

  • Facebook style messaging system schema design

    - by Jamie
    Hi all, I'm looking to implement a facebook style messaging system (thread messages) into a site of mine. Do you think this schema markup looks okay? Doctrine schema.yml: UserMessage: tableName: user_message actAs: [Timestampable] columns: id: { type: integer(10), primary: true, autoincrement: true } sender_id : { type: integer(10), notnull: true } sender_read: { type: boolean, default: 1 } subject: { type: string(255), notnull: true } message: { type: string(1000), notnull: true } hash: { type: string(32), notnull: true } relations: UserMessageRecipient as Recipient: type: many local: id foreign: message_id UserMessageReply as Reply: type: many local: id foreign: message_id UserMessageReply: tableName: user_message_reply columns: id: { type: integer(10), primary: true, autoincrement: true } user_message_id as message_id: { type: integer(10), notnull: true } message: { type: string(1000), notnull: true } sender_id: { type: integer(10), notnull: true } relations: UserMessage as Message: local: message_id foreign: id type: one UserMessageRecipient: tableName: user_message_recipient actAs: [Timestampable] columns: id: { type: integer(10), primary: true, autoincrement: true } user_message_id as message_id: { type: integer(10), notnull: true } recipient_id: { type: integer(10), notnull: true } recipient_read: { type: boolean, default: 0 } When I a new reply is made,i'll make sure the boolean for "recipient_read" for each recipient is set to false and of course i'll make sure sender_read is set to false too. I'm using a hash for the URL: http://example.com/user/messages/aadeb18f8bdaea49882ec4d2a8a3c062 (As the id will be starting from 1, i don't wish to have http://example.com/user/messages/1. Yeah, I could start incrementing from a bigger number, but i'd prefer to start at 1.) Is this a good way to go about it? Your thoughts and suggestions would be hugely appreciated. Thanks guys!

    Read the article

  • Question about a dialog form and submit errors

    - by user248959
    Hi, I have the link below that executes the action message/new which shows a form inside a jqueryui modal dialog. <div id="myDialog"> </div> echo jq_link_to_remote('Enviar mensaje', array( 'url' => 'mensaje/new?receptor='.$miembro->getId().'&tipo=0&estado=0', 'update' => 'myDialog', 'complete' => "jQuery('#myDialog').dialog({ width:375, height:220, top:123, resizable:false, modal:true, autoOpen: false }); jQuery('#myDialog').dialog('open')" )); The point: if there are submit errors the form is not showed inside the dialog form but in a empty page (mensaje/create).. Any idea? Javi

    Read the article

  • Doctrine: textarea line breaks & nl2br

    - by Tom
    Hi, I'm pulling my hair out with something that should be very simple: getting line breaks to show up properly in text that's returned from the database with Doctrine 1.2 I'm saving a message: $body = [text from a form textarea]; $m = new Message(); $m->setSubject($subject); $m->setBody($body); $m->save(); Querying the message: $q = Doctrine_Query::create() ->from('Message m') ->where('m.message_id = ?', $id) ->limit(1); $this->message = $q->execute(array(), Doctrine_Core::HYDRATE_ARRAY); In my template: echo $message[0]['body'] ... outputs the text without line breaks echo ln2br($message[0]['body']) ... no difference ... and I've tried every combination I could think of. Is Doctrine doing something to line breaks that's affecting this, or is there something that I'm just missing? Any help would be appreciated. Thanks.

    Read the article

  • How to apply query to model if field not filtered

    - by jdog
    I have a range of modules running on generator.yml. In some of those I would like to hide records by default of Status: CLOSED (being the last of a range of Statuses). OF course if the user filters for CLOSED i want to show these records. I thought it would make sense to apply andWhere('status_id=?',Status::CLOSED) in a specific table_method , but how do I access the filters of the module from within the model? Is there a better way to do this?

    Read the article

  • Two differents FOSUser in application

    - by Jérôme Boé
    I face a problem with FOSUserBundle. In my Symfony2 application, I want to implement two differents User. I have one entity User, for basic user, and one entity UserPro with more informations. My problem is that I want to configure my bundle with this two entities: fos_user: db_driver:     orm firewall_name: main user_class:    Btp\UserBundle\Entity\User fos_userpro: db_driver:     orm firewall_name: pro user_class:    Btp\UserProBundle\Entity\UserPro And so, use fos_user and fos_userpro as provider in my security.yml. I'm no sure it's be possible. I obtain an error : There is no extension able to load the configuration for "fos_userpro" (in /..../app/config/config.yml). Looked for namespace "fos_userpro", found "framework", "security", ... And when I take a look in FOSUserBundle files, I feel that fos_user is not a configuration variable and is directly written in strings. Thanks.

    Read the article

  • Is it possible that two requests at the same time double this code? (prevent double database entry)

    - by loostro
    1) The controller code (Symfony2 framework): $em = $this->getDoctrine()->getEntityManager(); // get latest toplist $last = $em->getRepository('RadioToplistBundle:Toplist')->findOneBy( array('number' => 'DESC') ); // get current year and week of the year $week = date('W'); $year = date('Y'); // if: // [case 1]: $last is null, meaning there are no toplists in the database // [case 2]: $last->getYear() or $last->getWeek() do not match current // year and week number, meaning that there are toplists in the // database, but not for current week // then: // create new toplist entity (for current week of current year) // else: // do nothing (return) if($last && $last->getYear() == $year && $last->getWeek() == $week) return; else { $new = new Toplist(); $new->setYear($year); $new->setWeek($week); $em->persist($new); $em->flush(); } This code is executed with each request to view toplist results (frontend) or list of toplists (backend). Anytime someone wants to access the toplist we first check if we should create a new toplist entity (for new week). 2) The question is: Is it possible that: User A goes to mydomain.com/toplist at 00:00:01 on Monday - the code should generate new entity the server slows down and it takes him 3 seconds to execute the code so new toplist entity is saved to database at 00:00:04 on Monday User B goes to mydomain.com/toplist at 00:00:02 on Monday at 00:00:02 there the toplist is not yet saved in database, thus UserB's request triggers the code to create another toplist entity And so.. after a few seconds we have 2 toplist entities for current week. Is this possible? How should I prevent this?

    Read the article

  • Trying to join two independent forms

    - by user248959
    Hi, i'm trying to join two independent forms (login and register) in the same page. My idea is (just looking at the signin form): Create an action that shows both forms (partials): public function executeLoginAndRegister(sfWebRequest $request){ $this->form_signin = $this->getUser()->getAttribute('form_signin'); } Each partial calls to its action: form action="php? echo url_for('@sf_guard_signin') ?" method="post" In the actions i write this code public function executeSignin($request) { //... $this->form = new $MyFormclass(); if ($this->form->isValid()) { //... }else{ // save the form to show the error messages. $this-&gt;getUser()-&gt;setAttribute('form_signin', $this-&gt;form); return $this-&gt;forward('sfGuardAuth', 'loginAndRegister'); } } It works, but, for example, if i execute LoginAndRegister and submit incorrectly the signin form and I go to another page and then return to LoginAndRegister, i will find the submiting error messages... If i execute LoginAndRegister and submit incorrectly the signin form and open another browser tab, i will find the submiting error messages in the signin form of the second tab... Any idea? any better approach?

    Read the article

  • Reduce the number of additional Queries to 0 by overriding functions in the base model

    - by user334017
    my basic database setup is: User:... Info: relations: User: { foreignType:one } When displaying information on the user it takes: 1 query to find info on the user, and 1 query to find additional info I want to reduce this to one query that finds both, I assume I need to override a function from BaseUser.class.php, or something along those lines but I'm not really sure what to do. Thanks!

    Read the article

  • Pagination - Symfoy

    - by user390426
    Hi I have the following code: public function executeList() { $c = new Criteria(); $c->setLimit(5); $this->latest = ItemPeer::doSelectLatest($c); } Now I'd like to be able to use pagination with this, using sfPropelPager. How could I use that with the code above, making sure It paginates results from the peer method? Thanks EDIT: Got it working: $pager = new sfPropelPager('Item', 10); $pager->setPage($request->getParameter('page', 1)); $pager->setPeerMethod('doSelectLatest'); $pager->init(); $this->pager = $pager; Thanks!

    Read the article

  • Log into file or database, readability question

    - by Fungsten
    Hi there! Right now I'm logging some info of the user in my web app in a log file to observe the usage & interest for some services, but I'm interested in checking that info in a readeable way, so I'm questioning if maybe I shall save that info in a database and then retrieve it to show it in tables or whatever. It's better to log in the database for my purposes? Or logging like now I could select/order the info of the log easily?

    Read the article

  • Weird error: [Semantical Error] line 0, col 75 near 'submit': Error: 'submit' is not defined.

    - by luxury
    My controller like: /** * @Route("/product/submit", name="product_submit") * @Template("GaorenVendorsBundle:Product:index.html.twig") */ public function submitAction() { $em = $this->getDoctrine()->getManager(); $uid = $this->getUser()->getId(); $em->getRepository( 'GaorenVendorsBundle:Product' )->updateStatus( $uid, Product::STATUS_FREE, Product::STATUS_PENDING ); return $this->redirect( $this->generateUrl( 'product' ) ); } and the repo like: class ProductRepository extends EntityRepository { public function updateStatus($uid, $status, $setter) { $st = $this->getEntityManager()->getRepository( 'GaorenVendorsBundle:Product' ) ->createQueryBuilder( 'p' ) ->update( 'GaorenVendorsBundle:Product', 'p' ) ->set( 'p.status', ':setter' ) ->where( 'p.status= :status AND p.user= :user' ) ->setParameters( array( 'user' => $uid, 'status' => $status, 'setter' => $setter ) ) ->getQuery() ->execute() return $st; } when request the "submit" action, it prompts me "[Semantical Error] line 0, col 75 near 'submit': Error: 'submit' is not defined. ". "submit" is nothing to do with DOCTRINE orm query, why it appears in the error? I just can't figure out.Anyone could tell me?

    Read the article

  • showing get variables after calling setTemplate()

    - by user334017
    I have a showSuccess page that requires some get variables, and on that page is a form. When the form submits to executeCreate() and there is an error, it calls the function setTemplate('show') and returns back to showSuccess. However, the get variables are missing. How do I keep the url the same?

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23  | Next Page >