Search Results

Search found 119 results on 5 pages for 'yii'.

Page 4/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Foreign Key Relationships and "belongs to many"

    - by jan
    I have the following model: S belongs to T T has many S A,B,C,D,E (etc) have 1 T each, so the T should belong to each of A,B,C,D,E (etc) At first I set up my foreign keys so that in A, fk_a_t would be the foreign key on A.t to T(id), in B it'd be fk_b_t, etc. Everything looks fine in my UML (using MySQLWorkBench), but generating the yii models results in it thinking that T has many A,B,C,D (etc) which to me is the reverse. It sounds to me like either I need to have A_T, B_T, C_T (etc) tables, but this would be a pain as there are a lot of tables that have this relationship. I've also googled that the better way to do this would be some sort of behavior, such that A,B,C,D (etc) can behave as a T, but I'm not clear on exactly how to do this (I will continue to google more on this) What do you think is the better solution? UML: Here's the DDL (auto generated). Just pretend that there is more than 3 tables referencing T. -- ----------------------------------------------------- -- Table `mydb`.`T` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mydb`.`T` ( `id` INT NOT NULL AUTO_INCREMENT , PRIMARY KEY (`id`) ) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`S` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mydb`.`S` ( `id` INT NOT NULL AUTO_INCREMENT , `thing` VARCHAR(45) NULL , `t` INT NOT NULL , PRIMARY KEY (`id`) , INDEX `fk_S_T` (`id` ASC) , CONSTRAINT `fk_S_T` FOREIGN KEY (`id` ) REFERENCES `mydb`.`T` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`A` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mydb`.`A` ( `id` INT NOT NULL AUTO_INCREMENT , `T` INT NOT NULL , `stuff` VARCHAR(45) NULL , `bar` VARCHAR(45) NULL , `foo` VARCHAR(45) NULL , PRIMARY KEY (`id`) , INDEX `fk_A_T` (`T` ASC) , CONSTRAINT `fk_A_T` FOREIGN KEY (`T` ) REFERENCES `mydb`.`T` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`B` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mydb`.`B` ( `id` INT NOT NULL AUTO_INCREMENT , `T` INT NOT NULL , `stuff2` VARCHAR(45) NULL , `foobar` VARCHAR(45) NULL , `other` VARCHAR(45) NULL , PRIMARY KEY (`id`) , INDEX `fk_A_T` (`T` ASC) , CONSTRAINT `fk_A_T` FOREIGN KEY (`T` ) REFERENCES `mydb`.`T` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`C` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mydb`.`C` ( `id` INT NOT NULL AUTO_INCREMENT , `T` INT NOT NULL , `stuff3` VARCHAR(45) NULL , `foobar2` VARCHAR(45) NULL , `other4` VARCHAR(45) NULL , PRIMARY KEY (`id`) , INDEX `fk_A_T` (`T` ASC) , CONSTRAINT `fk_A_T` FOREIGN KEY (`T` ) REFERENCES `mydb`.`T` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB;

    Read the article

  • Getting specific data from database

    - by ifsession
    I have a table called Categorie with a few columns and I'm trying to get only a few out of my database. So I've tried this: $sql = 'SELECT uppercat AS id, COUNT(uppercat) AS uppercat FROM categorie GROUP BY uppercat;'; $d = Yii::app()->db->createCommand($sql)->query(); But I find the output strange. I was trying to do an array_shift but I get an error that this isn't an array. When I do a var_dump on $d: object(CDbDataReader)[38] private '_statement' => object(PDOStatement)[37] public 'queryString' => string 'SELECT uppercat AS id, COUNT(uppercat) AS uppercat FROM categorie GROUP BY uppercat;' (length=100) private '_closed' => boolean false private '_row' => null private '_index' => int -1 private '_e' (CComponent) => null private '_m' (CComponent) => null Ok.. then I did a foreach on $d: array 'id' => string '0' (length=1) 'uppercat' => string '6' (length=1) array 'id' => string '3' (length=1) 'uppercat' => string '2' (length=1) array 'id' => string '6' (length=1) 'uppercat' => string '1' (length=1) array 'id' => string '7' (length=1) 'uppercat' => string '2' (length=1) array 'id' => string '9' (length=1) 'uppercat' => string '2' (length=1) Then why do I get the message that $d isn't an array while it contains arrays? Is there any other way on how to get some specific data out of my database and that I can then do an array_shift on them? I've also tried doing this with findAllBySql but then I can't reach my attribute for COUNT(uppercat) which is not in my model. I guess I'd have to add it to my model but I wouldn't like that because I need it just once.

    Read the article

  • Accessing a module's action rendered output

    - by Flavius
    Hi. I'm writing an "Account" module which should take care of everything about accounts: registration, login/logout, user administration, password recovery, account activation, etc. So I thought it would be best to reuse whatever the module's DefaultController::actionRegister() generates to show on the main page. So my question is: how to create a new "sub request" (similar to CController::forward()) from any controller (either SiteController, read: from views/layouts/main.php, or another controller, eventually of another submodule) to a given module/controller/action? I've tried with $this-forward() from within my application layout without success: it shows a blank page, no error whatsoever. Thanks

    Read the article

  • How to customize BsGridView to show links instead of BsButtonColumn?

    - by felipe.zkn
    Given the code below, I need to customize the third column to show two links instead of that BsButtonColumn. I didn't find any related documentation to get the answer. <?php $this->widget( 'bootstrap.widgets.BsGridView', array( 'id' => 'activity-translation-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array( 'id', 'name', array( 'class' => 'BsButtonColumn', ), ), ) ); ?>

    Read the article

  • Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

    - by Fotis
    I am a newbie programmer, so I will need your help! Locally the webapp works ok with the db on it! When I uploaded the application on the cloudcontrol, it comes up with the following error: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)! I suppose I have not uploaded the db. This is the very first time I upload a webapp on a server so I do not know the exact steps that I have to follow in order to upload the db on a server. Cloudcontrol has documentation about mysql! I did follow the steps but the webapp comes with the same error! Could you please tell me what steps I have to follow in order to make it working? I am sure that this error is due to lack of knowledge!

    Read the article

  • Modify links in CListView pager to follow routing

    - by Thorpe Obazee
    I currently have this: <?php $this->widget('zii.widgets.CListView', array( 'dataProvider'=>$model, 'itemView'=>'_view', 'template' => '{items}{pager}' )); ?> The Pager shows me paginations to posts/index?page=2, posts/index?page=3. The problem is that I have routed blog/posts to posts. I am on blog/posts now and all the links in the Pager is showing me posts/index?page=2, page/index?page=3. I want to have the pager showing links to blog/posts/index?page=2, blog/posts/index?page=3 This my current routing for this: 'urlFormat'=>'path', 'rules'=>array( 'blog/posts' => 'posts', How should I do this? Update: For those confused as to what I am saying:

    Read the article

  • CGridView Filter doesn't work when you add more than one button to the CButtonColumn

    - by era
    I have a CGridView as follows, <?php $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'order-grid', 'dataProvider'=>$model->search(), 'filter'=>$model, 'columns'=>array( 'order_id', //'ordered_datetime', 'customer_id', 'status', //'delivery_address', array( 'class'=>'CButtonColumn', 'template' => '{view} {rollback} {receive}{pack} {dispatch}{delivered}', 'htmlOptions'=>array('width'=>'250px'), 'buttons'=>array( 'receive'=>array( 'id'=>'receive', 'name'=>'receive', 'url'=>'$this->grid->controller->createUrl("/shop/order/admin&received=true", array("id"=>$data->order_id,"asDialog"=>1,"gridId"=>$this->grid->id))', 'type'=>'submit', 'imageUrl'=>'/mdg/images/Receive1.png', 'visible'=>'($data->status=="pending")?true:false;' ), 'rollback'=>array( 'id'=>'rollback', 'name'=>'rollback', 'url'=>'$this->grid->controller->createUrl("/shop/order/admin&rollback=true", array("id"=>$data->order_id,"asDialog"=>1,"gridId"=>$this->grid->id))', 'imageUrl'=>'/mdg/images/rollback.jpg', 'visible'=>'($data->status=="pending")?false:true;' ), ), ), ), )); ? And When I add one more button to the buttons array, the filter doesnt work. Any Idea why that is? It's Great if anyone can help.. Thanks!

    Read the article

  • how to do multi insert and obtain ids

    - by liysd
    hi, I want to insert some data into a table (id PK autoincrement, val) with use multi insert INSERT INTO tab (val) VALUES (1), (2), (3) Is it possible to obtain a table of last inserted ids? I'm asking becouse I'm not sure if all will in this form: (n, n+1, n+2). I use mysql inodb.

    Read the article

  • Why each request with activerecord is doing SHOW TABLE?

    - by dynback.com
    My test page is processed if believe to trace in 46 ms, while 11 of them I am doing this 20:53:06.111597 system.db.CDbConnection Opening DB connection 20:53:06.118046 system.db.CDbCommand Querying SQL: SHOW COLUMNS FROM `questions` 20:53:06.122476 system.db.CDbCommand Querying SQL: SHOW CREATE TABLE `questions` Is this obligatory?

    Read the article

  • How to convince boss to start using Codeigniter or YII at work?

    - by mahen23
    Hello, i work for a web development company and during the one year i have spent here, there were no improvements in the technologies we used to built our websites. I introduced jquery to them (buying the Novice to Ninja by Sitepoint) and now, i want to get rid of all these crappy PHP from scratch and use a PHP framework instead. So what reasoning i can use to convince my boss to switch, and how to convice the other developers too?

    Read the article

  • Does using a PHP framework count as experience using PHP to a company that doesn't use that framework?

    - by sq1020
    I've started working at a company that uses the Yii PHP framework. I'm mostly using Yii but also some frontend stuff like jQuery and Ajax. What I'm worried about is limiting my skill set to a framework that isn't very popular. I mean, if the company I worked for was using Ruby on Rails or even Django, I wouldn't have this feeling of concern for the future. My first question is then, in regards to being able to find a job in the future somewhere else, is my feeling of concern warranted? Secondly, I see a lot of PHP jobs out there but do you think experience using a PHP framework counts as valuable experience to a company that doesn't use that particular framework or any framework at all?

    Read the article

  • Zend Framwork scaffolding capabilities

    - by rockstarz
    Are there any open source projects any of you would recommend to follow or contribute toward, including those already documented among the zf contributors, to add zend framework scaffolding of crud functionality for rapid development as found in many competitors frameworks (Yii, Symfony, Rails, Django, etc.)? As a user of zf on a daily basis on enterprise implementations, I know this is a topic of interest and I feel professional developers like you would find here would have something to contribute toward my question and finding a library that is underway that can be contributed to.

    Read the article

  • How to suppress PHPSESSID in URL for Googlebot?

    - by Roque Santa Cruz
    I use cookie based sessions, and they work for normal interaction with our site. However, when Googlebot comes crawling out PHP framework, Yii, needs to append ?PHPSESSID to each URL, which doesn't look that good in SERP. Any ways to suppress this behavior? PS. I tried to utilize ini_set('session.use_only_cookies', '1');, but it does not work. PPS. To get an impression of the SERP, they look like this: http://www.google.com/search?q=site:wwwdup.uni-leipzig.de+inurl:jobportal

    Read the article

  • Which PHP frameworks use in testing?

    - by EasyHB
    I am going to do a test/benchmark of some PHP frameworks. The main factor of comaparation will be a comunication with MySQL databases and CRUD operations with them. I'll also compare their documentation, comunity support, etc. So I made a list of some known frameworks and I'll be glad if someone can tell me which I should not use or which I forgot to include. Zend Framework CodeIgniter Symphony Yii Kohana Prado CakePHP Nette PhpBURN Akelos Recess Jelix DooPHP Qcodo Seagull Thx for every help.

    Read the article

  • How to plan a PHP based project with DB involved in the below scenario? [closed]

    - by San
    I'm starting a project on web monitoring where other websites can be monitored. Recently, I have found codeIgniter, yii, kohana frameworks online, but I'm confused as to whether to choose any of those or start directly. Moreover, this is my first big project that I'm planning for. So can anyone give me suggestions on how to start, how to plan, what books to refer to, to start this kind of web application and share some links to understand for myself on how to work on this project?

    Read the article

  • IIS virtual location path

    - by Worp
    Sorry in advance, for this seems to be a very noobish question and should be easily fixable, yet I can't work it out: I am setting up windows authentication for a website running on IIS 8.5: The Yii framework of the website takes input like http://localhost/mywebsite/index.php/site/loginand processes it, using the "login" action of the "site" Controller. I flipped on URL Rewrite to have nicer URLs, leaving the URL with /mywebsite/site/login. Now I need to set up windows authentication for this location. Very specifically ONLY for this very exact location. Only the /site/login location of mywebsite needs to have authentication. Every other location needs to have anonymous. Since it is a "virtual location", I don't know how to do it. I can set up win-auth for files, directories, virtual directories, etc. but not for virtual locations that do not map to any file but only to a Controller/Action in Yii. The working counterpart in Apache is but i can't "translate this into IIS". I have read that IIS does have the "~" symbol but I just couldn't make it work yet. Could it be used to achieve authentication on a location basis? I have looked around virtual directories as well, which seem to simply be a kind of "symlink" to actual folders on the harddrive. Can they be used differently to "create a virtual folder in a location that doesn't really exist to manage its properties"? Help is much appreciated.

    Read the article

  • Good php editor

    - by Web Developer
    i have seen through other questions on the topic but most are a bit old. I looking for a good editor for developing on PHP in Linux(ubuntu). Here is my requirements Basic editor features Free Light-Weight Syntax highlighting Code Folding (class,function,if/else/while/foreach block) Code completion Invalid Syntax/Error highlighting as you type Auto code intending Snippet support(pieces of custom or language specific codes that i can insert) Extendable support It would be great if it had the following Debugging support WYSIWYG Code formatting Framework support(cakephp/yii/zend/smarty) Testing support Todo Native look and feel(Gnome) Flex/ROR support is welcome but not a requirement Mysql support I have tried the following editors Netbeans - it bloated, resource hogging and doesnt not have a native look and feel. Eclipse is okay but i cant fold if/while blocks and slow. Gedit can be extended and i have tried it but still i could not fold code or show error. I currently use Geany but it doesn't inform me of syntax errors as i type. If you have ways to solve the problems with above editors they too are also welcome

    Read the article

  • Starting off with web dev with php

    - by pavan kumar
    I'm currently working with Java / C++. I'm interested in web development and am planning to shift my stream. I heard that PHP is a good platform to start off and also it does not require that much of knowledge in technologies like JSP / Servlets or frameworks like springs / struts / hibernate. I have basic ideas about HTML and Javascript as well. I have gone through previous posts in SO and found out the relevant resources as well: http://net.tutsplus.com/tutorials/php/the-best-way-to-learn-php/ http://www.webhostingtalk.com/archive/index.php/t-1028265.html http://www.killerphp.com/ http://phpforms.net/tutorial/tutorial.html http://www.php5-tutorial.com/ etc. Now, my question is: I heard of PHP frameworks like CodeIgniter, Zend Frameworkd and Yii. Doesn't learning PHP & MySql implicitly makes us aware of these frameworks? Am I making a good choice in stating with PHP? Is it a good idea to shift streams?

    Read the article

  • CDbException: CDbConnection failed to open the DB connection

    - by Vinay Rajput
    Hi I am new to ubuntu and php mysql, i have intalled xampp and learning Yii, but while testing a script i got this problem, not able to figure out the solution, i have been through many forums solutions but none of them worked for me. Please help. 1) DbTest::testConnection CDbException: CDbConnection failed to open the DB connection. /opt/lampp/htdocs/YiiRoot/framework/db/CDbConnection.php:388 /opt/lampp/htdocs/YiiRoot/framework/db/CDbConnection.php:331 /opt/lampp/htdocs/YiiRoot/framework/db/CDbConnection.php:309 /opt/lampp/htdocs/YiiRoot/framework/base/CModule.php:388 /opt/lampp/htdocs/YiiRoot/framework/base/CModule.php:104 /opt/lampp/htdocs/trackstar/protected/tests/unit/DbTest.php:6 FAILURES! Tests: 1, Assertions: 0, Errors: 1.

    Read the article

  • Increase traffic to a site through a site on subdomain [closed]

    - by user1716672
    Possible Duplicate: Subdomain versus subdirectory We have two sites, one is mainly a portfolio site (built with Yii framework) and the other is a digital shop (built with open cart) where we sell plugins and themes. The url's look like www.mydomian.com and www.store.mydomain.com. But of these sites are in the same server. We use google analytics tools and have no problem getting traffic to our store. But we have very little to our portfolio site and we want to increase our Google ranking for this site. Assuming increased traffic to our site will increase our google ranking, we were thinking to use URl masking so the link will be www.mydomain.com/shop and this will load www.store.mydomain.com. Will this count as hits for our portfolio site? Because the .htaccess rules will ensure the subdomain is served. So I dont know if these hits will count on our store or our portfolio site...

    Read the article

  • Help me get started in TDD for web development

    - by Snow_Mac
    I've done a tiny, tiny bit of TDD in building an app for a company that I interned with. We used lots of mocking and wrote lots of assert statements, after reading lots of blogs, I'm convinced that TDD is the way to go, but how do you go about TDD web applications? My main framework is Yii in PHP. My main questions are: What do you test? Models? Controllers? Views? How do you know if the output is correct? All my web apps interact with a DB, are there cavets to that and gotchas? Can I do testing in Netbeans? Can you test form elements or just strictly objects & methods?

    Read the article

  • Why should I adopt MVC?

    - by Andrew
    I decided to get my hands wet and got the YII framework for PHP. I created my first application, then created new controller, model and view. Connected to database, got my record passed from controller to the view and printed the hello world. I am confused now. If I have to do the same thing for each page, this seems like a nightmare to me. In each controller I have to do a lot of same operations - declare variables, and pass them to views. I also need to create models for each page and this is all confusing to me. In my idea the main goal of development is to avoid duplication, but what I see here is lots and lots of duplicated code. Please advise and clarify. Maybe you could suggest a good reading about MVC and coding patterns and best practices in MVC. Because so far, it takes much more time to create a small site using MVC than using my own programming schema.

    Read the article

  • Writing a desktop application for progammer from PHP background

    - by Mark
    I have a client who wants a tool for him to be able to upload his products, enter orders, and keep track of customer details. There are quite a few highly customised requests, which is why he wants the tool custum made. He does not care much about the interface design - it just has to be usable and provide access to the databade. I've already designed the database. I have no experience of desktop applications and usually write my web apps in PHP with the Yii framework. But hosting this on a server seems like overkill. I also have .net experience from a few years ago. What would be the best options for writing this as a desktop application?

    Read the article

  • handling the holding of money on a platform

    - by user1716672
    We are building a platform for a client, developed in Yii, where users can top up their account on the platform with money from paypal. Users can upload files and buy access to each others files. User can also gift other users with money. I was thinking that when users top up their account, the money goes rom their Paypal to the merchant account of the website. So all users' money goes to one merchant account. Then, any transactions on the platform are simply recorded on the platform and each users' balance is the maximum amount they can withdraw from the merchant account. Is this the right approach? Legally, are there any problems?

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >