Search Results

Search found 383 results on 16 pages for 'doctrine'.

Page 8/16 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Doctrine: how to create a query using "LIKE REPLACE" ?

    - by user248959
    Hi, this SQL clause is working OK: SELECT * FROM `sf_guard_user` WHERE nombre_apellidos LIKE REPLACE('Mar Sanz',' ','%') Now I'm trying to write this query for Doctrine. I have tried this: $query->andWhere(sprintf('%s.%s LIKE REPLACE (?," ","%")', $query->getRootAlias(), $fieldName), 'Mar Sanz')); but I get this error: Warning: sprintf() [function.sprintf]: Too few arguments Any idea? Regards Javi

    Read the article

  • How can I change the `invalid` message of doctrine?

    - by roddik
    Hi. I'm using symfony with doctrine and I make a registration form. Email field is declared unique and if I set it to already existing one, I get the message An object with the same "email" already exist.. I use the following validator: $this->validatorSchema['email'] = new sfValidatorEmail(array('required' => true), array('invalid' => 'Does not seem to be a proper email')); How can I change the "already exists" message? Thanks

    Read the article

  • using onDelete with Doctrine 2

    - by tamir
    I can't get the onDelete to work in Doctrine2 (with YAML Mapping). I tried this relation in my Product class: oneToOne: category: targetEntity: Category onDelete: CASCADE But that doesn't work.. EDIT: I've set the ON DELETE: CASCADE manually in the database imported the YAML mapping with doctrine:mapping:import, emptied the database updated it from the schema with doctrine:schema:update and got no ON DELETE in the foreign key.. so looks like even Doctrine doesn't know how to do it lol..

    Read the article

  • PHP Doctrine - YAML syntax help. Default value for many to many relationship?

    - by Dan
    Hi, I have the following YAML schema for organising users in Doctrine: Person: tableName: people columns: id: type: integer primary: true autoincrement: true firstname: type: string notnull: true lastname: type: string notnull: true User: inheritance: extends: Person type: column_aggregation keyField: type keyValue: 1 Userdetails: columns: person_id: type: integer primary: true password: type: string notnull: true relations: User: foreignType: one local: person_id onDelete: CASCADE onUpdate: CASCADE Group: tableName: groups columns: id: type: integer primary: true autoincrement: true name: type: string notnull: true UserGroup: columns: group_id: type: integer primary: true person_id: type: integer primary: true relations: User: foreignType: many local: person_id Group: foreignType: many Basically, any people who are users will belong to one or more groups. Is there any way to add new users to a particular group by default? Any advice appreciated. Thanks

    Read the article

  • What is the best way to convert a doctrine nested set to an li-structure?

    - by murze
    Hi, I'm using Doctrine NestedSet behavior. I'd like to render the tree using php to <ul>'s and <li>'s Here's an example of what the output might be: <ul> <li>Node 1</li> <li>Node 2 <ul> <li>Child 1 of Node 2</li> <li>Child 2 of Node 2 <ul> <li>Another Child</li> <li>Yet Another Child</li> </ul> </li> </ul> </li> <li>Node 3</li> </ul> What is the best way to do this?

    Read the article

  • What action is my Symfony/Doctrine generated form actually going to?

    - by Arms
    In my Symfony 1.4 project I am using the doctrine:generate-admin task to create the modules that compose my backend system. One such module is "journeys". When I view the source of the "journeys/new" page (which displays the form to create a new journey entity) the action of the form is simply "journeys" (I expected it to be "journeys/create"). The "journeys" route on its own would call the executeIndex method - however I put a log call in there and upon form submission, the log is not made. So this leads me to believe that executeIndex is NOT being called, and another piece of code is being fired upon form submission that then (depending on a hidden input in the form) calls either executeCreate() or executeUpdate(). Problem is, I don't know where that would be happening. Any insight would be much appreciated. I don't if this is relevant, but here is the routing definition for the journeys module journey: class: sfDoctrineRouteCollection options: model: journey module: journeys prefix_path: /journeys column: id with_wildcard_routes: true Thanks!

    Read the article

  • Database and query to store and retreive friend list [migrated]

    - by amr Kamboj
    I am developing a module in website to save and retreive friend list. I am using Zend Framework and for DB handling I am using Doctrine(ORM). There are two models: 1) users that stores all the users 2) my_friends that stores the friend list (that is refference table with M:M relation of user) the structure of my_friends is following ...id..........user_id............friend_id........approved.... ...10.........20 ..................25...................1.......... ...10.........21 ..................25...................1.......... ...10.........22 ..................30...................1.......... ...10.........25 ..................30...................1.......... The Doctrine query to retreive friend list id follwing $friends = Doctrine_Query::create()->from('my_friends as mf') ->leftJoin('mf.users as friend') ->where("mf.user_id = 25") ->andWhere("mf.approved = 1"); Suppose I am viewing the user no.- 25. With this query I am only getting the user no.- 30. where as user no.- 25 is also approved friend of user no.- 20 and 21. Please guide me, what should be the query to find all friend and is there any need to change the DB structure.

    Read the article

  • Why does my Doctrine DBAL query return no results when quoted?

    - by braveterry
    I'm using the Doctrine DataBase Abstraction Layer (DBAL) to perform some queries. For some reason, when I quote a parameter before passing it to the query, I get back no rows. When I pass it unquoted, it works fine. Here's the relevant snippet of code I'm using: public function get($game) { load::helper('doctrinehelper'); $conn = doctrinehelper::getconnection(); $statement = $conn->prepare('SELECT games.id as id, games.name as name, games.link_url, games.link_text, services.name as service_name, image_url FROM games, services WHERE games.name = ? AND services.key = games.service_key'); $quotedGame = $conn->quote($game); load::helper('loghelper'); $logger = loghelper::getLogger(); $logger->debug("Quoted Game: $quotedGame"); $logger->debug("Unquoted Game: $game"); $statement->execute(array($quotedGame)); $resultsArray = $statement->fetchAll(); $logger->debug("Number of rows returned: " . count($resultsArray)); return $resultsArray; } Here's what the log shows: 01/01/11 17:00:13,269 [2112] DEBUG root - Quoted Game: 'Diablo II Lord of Destruction' 01/01/11 17:00:13,269 [2112] DEBUG root - Unquoted Game: Diablo II Lord of Destruction 01/01/11 17:00:13,270 [2112] DEBUG root - Number of rows returned: 0 If I change this line: $statement->execute(array($quotedGame)); to this: $statement->execute(array($game)); I get this in the log: 01/01/11 16:51:42,934 [2112] DEBUG root - Quoted Game: 'Diablo II Lord of Destruction' 01/01/11 16:51:42,935 [2112] DEBUG root - Unquoted Game: Diablo II Lord of Destruction 01/01/11 16:51:42,936 [2112] DEBUG root - Number of rows returned: 1 Have I fat-fingered something?

    Read the article

  • Doctrine: How to traverse from an entity to another 'linked' entity?

    - by ropstah
    I'm loading 3 different tables using a cross-join in Doctrine_RawSql. This brings me back the following object: User -> User class (doctrine base class) Settings -> DoctrineCollection of Setting User_Settings -> DoctrineCollection of User_Setting The object above is the result of a many-to-many relationship between User and Setting where User_Setting acts as a reference table. User_Setting also contains another field named value. This obviously contains the value of the corresponding Setting. All good so far, however the Settings and User_Settings properties of the returned User object are in no way linked to each other (apart from the setting_id field ofcourse). Is there any direct way to traverse directly from the Settings property to the corresponding User_Settings property? This is the corresponding query: $sets = new Doctrine_RawSql(); $sets->select('{us.*}, {s.*}, {uset.*}') ->from('(User us CROSS JOIN Setting s) LEFT JOIN User_Setting uset ON us.user_id = uset.user_id AND s.setting_id = uset.setting_id') ->addComponent('us', 'User us') ->addComponent('uset', 'us.User_Setting uset') ->addComponent('s', 'us.Setting s') ->where('s.category_id = ? AND us.usr_auto_key = ?',array(1, 1)); $sets = $sets->execute();

    Read the article

  • Symfony, in remote host: Error 500. Unknown record property / related component "algorithm" on "sfGu

    - by user248959
    Hi, after deploying, i get the error below after loggingin. Sf 1.3, sfDoctrineGuardPlugin. And i have this schema.yml in config/doctrine: Usuario: inheritance: extends: sfGuardUser type: simple columns: username: type: string(128) notnull: false unique: true nombre_apellidos: string(60) sexo: string(5) fecha_nac: date provincia: string(60) localidad: string(255) email_address: string(255) fotografia: string(255) avatar: string(255) avatar_mensajes: string(255) relations: Usuario: local: user1_id foreign: user2_id refClass: AmigoUsuario equal: true 500 | Internal Server Error | Doctrine_Record_UnknownPropertyException Unknown record property / related component "algorithm" on "sfGuardUser" stack trace * at () in SF_ROOT_DIR/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record/Filter/Standard.php line 55 ... 52. */ 53. public function filterGet(Doctrine_Record $record, $name) 54. { 55. throw new Doctrine_Record_UnknownPropertyException(sprintf('Unknown record property / related component "%s" on "%s"', $name, get_class($record))); 56. } 57. } * at Doctrine_Record_Filter_Standard->filterGet(object('sfGuardUser'), 'algorithm') in SF_ROOT_DIR/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record.php line 1382 ... 1379. $success = false; 1380. foreach ($this->_table->getFilters() as $filter) { 1381. try { 1382. $value = $filter->filterGet($this, $fieldName); 1383. $success = true; 1384. } catch (Doctrine_Exception $e) {} 1385. } * at Doctrine_Record->_get('algorithm', 1) in SF_ROOT_DIR/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record.php line 1337 ... 1334. return $this->$accessor($load); 1335. } 1336. } 1337. return $this->_get($fieldName, $load); 1338. } 1339. 1340. protected function _get($fieldName, $load = true) * at Doctrine_Record->get('algorithm') in SF_ROOT_DIR/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/record/sfDoctrineRecord.class.php line 212 ... 209. return call_user_func_array( 210. array($this, $verb), 211. array_merge(array($entityName), $arguments) 212. ); 213. } else { 214. $failed = true; 215. } * at sfDoctrineRecord->__call(array(object('sfGuardUser'), 'get'), array('algorithm')) in n/a line n/a ... * at sfGuardUser->getAlgorithm('getAlgorithm', array()) in SF_ROOT_DIR/plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardUser.class.php line 96 ... 93. */ 94. public function checkPasswordByGuard($password) 95. { 96. $algorithm = $this->getAlgorithm(); 97. if (false !== $pos = strpos($algorithm, '::')) 98. { 99. $algorithm = array(substr($algorithm, 0, $pos), substr($algorithm, $pos + 2)); * at PluginsfGuardUser->checkPasswordByGuard() in SF_ROOT_DIR/plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardUser.class.php line 83 ... 80. } 81. else 82. { 83. return $this->checkPasswordByGuard($password); 84. } 85. } 86. * at PluginsfGuardUser->checkPassword('m') in SF_ROOT_DIR/lib/sfGuardValidatorUserByEmail.class.php line 28 ... 25. { 26. // password is ok? 27. 28. if ($user->checkPassword($password)) 29. { 30. 31. //die("entro"); * at sfGuardValidatorUserByEmail->doClean('m') Any idea? Javi

    Read the article

  • doctrine regenerating models from yml only the base models?

    - by TaMeR
    I am wondering if there is a way to handle this more elegantly. After generating the "main" models and base models from yml files the first time I have to add at the very leased an include for the base model to the "main" model like so: include_once 'generated/BaseBlog.php'; At the moment before I regenerate the models I move my changed main models, which is mostly way more then just the include path, in to a tmp folder then I delete all the models. And after regenerating I move my modified models back overwriting the generated main models. isn't there a way to just create the base models and not touch the main models? Or how do you guys handle this?

    Read the article

  • Doctrine: Unknown table alias. Is this DQL correct?

    - by ropstah
    I'm trying to execute a query but I get an error: Unknown table alias The tables are setup as follows: Template_Spot hasOne Template Template hasMany Template_Spot Template hasMany Location Location hasOne Template I'm trying to execute the following DQL: $locationid = 1; $spots = Doctrine_Query::create() ->select('cts.*, ct.*, uc.*') ->from('Template_Spot cts') ->innerJoin('Template ct') ->innerJoin('Location uc') ->where('uc.locationid = ?', $locationid)->execute(); Does anyone spot a problem?

    Read the article

  • how can I solve a problem with andWhere with symfony/doctrine and odbc?

    - by JaSk
    While following the symfony tutorial (1.4.4) I'm getting an error with ODBC/mssql 2008. SQLSTATE[07002]: COUNT field incorrect: 0 [Microsoft][SQL Server Native Client 10.0]COUNT field incorrect or syntax error (SQLExecute[0] at ext\pdo_odbc\odbc_stmt.c:254). Failing Query: "SELECT [j].[id] AS [j__id], [j].[category_id] AS [j__category_id], [j].[type] AS [j_type], [j].[company] AS [j_company], [j].[logo] AS [j_logo], [j].[url] AS [j_url], [j].[position] AS [j_position], [j].[location] AS [j_location], [j].[description] AS [j__description], [j].[how_to_apply] AS [j__how_to_apply], [j].[token] AS [j__token], [j].[is_public] AS [j__is_public], [j].[is_activated] AS [j__is_activated], [j].[email] AS [j__email], [j].[expires_at] AS [j__expires_at], [j].[created_at] AS [j__created_at], [j].[updated_at] AS [j__updated_at] FROM [jobeet_job] [j] WHERE ([j].[category_id] = '2' AND [j].[expires_at] ?) ORDER BY [j].[expires_at] DESC" I've narrowed the problem to a line that uses parameters public function getActiveJobs(Doctrine_Query $q = null) { if (is_null($q)) { $q = Doctrine_Query::create() -from('JobeetJob j'); } //$q->andWhere('j.expires_at > \''.date('Y-m-d H:i:s', time()).'\'');<-- this works $q->andWhere('j.expires_at > ?', date('Y-m-d H:i:s', time())); //<-- this line has problem $q->addOrderBy('j.expires_at DESC'); return $q->execute(); } can anyone point me in the right direction? Thanks.

    Read the article

  • How to define an n-m relation in doctrine?

    - by murze
    If got a table "Article" and a table "Tags". Articles can have multiple tags and tags can hang to multiple articles. The class BaseArticle looks like this: abstract class BaseArticle extends Doctrine_Record { public function setTableDefinition() { $this->setTableName('article'); $this->hasColumn('article_id', 'integer', 8, array( 'type' => 'integer', 'length' => 8, 'fixed' => false, 'unsigned' => false, 'primary' => true, 'autoincrement' => true, )); $this->hasColumn('title', 'string', null, array( 'type' => 'string', 'fixed' => false, 'unsigned' => false, 'primary' => false, 'notnull' => false, 'autoincrement' => false, )); $this->hasColumn('text', 'string', null, array( 'type' => 'string', 'fixed' => false, 'unsigned' => false, 'primary' => false, 'notnull' => false, 'autoincrement' => false, $this->hasColumn('url', 'string', 255, array( 'type' => 'string', 'length' => 255, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'notnull' => false, 'autoincrement' => false, )); } public function setUp() { parent::setUp(); $this->hasMany('Tag as Tags', array( 'local' => 'article_id', 'foreign'=>'tag_id', 'refClass'=>'Articletag') ); } } The BaseTag-class like this: abstract class BaseTag extends Doctrine_Record { public function setTableDefinition() { $this->setTableName('tag'); $this->hasColumn('tag_id', 'integer', 4, array( 'type' => 'integer', 'length' => 4, 'fixed' => false, 'unsigned' => false, 'primary' => true, 'autoincrement' => true, )); $this->hasColumn('name', 'string', null, array( 'type' => 'string', 'fixed' => false, 'unsigned' => false, 'primary' => false, 'notnull' => false, 'autoincrement' => false, )); } public function setUp() { parent::setUp(); $this->hasMany('Article as Articles', array( 'local' => 'tag_id', 'foreign'=>'article_id', 'refClass'=>'Articletag') ); } } And the relationship class like this: abstract class BaseArticletag extends Doctrine_Record { public function setTableDefinition() { $this->setTableName('articletag'); $this->hasColumn('article_id', 'integer', 8, array( 'type' => 'integer', 'length' => 8, 'fixed' => false, 'unsigned' => false, 'primary' => true, 'autoincrement' => false, )); $this->hasColumn('tag_id', 'integer', 4, array( 'type' => 'integer', 'length' => 4, 'fixed' => false, 'unsigned' => false, 'primary' => true, 'autoincrement' => false, )); } public function setUp() { parent::setUp(); } } When I try to get a property from the article all goes well by using: $article = Doctrine_Query::create()->from('Article a') ->where('id = ?' , 1) ->fetchOne(); echo $article->title; //gives me the title But when I try this: foreach($article->Tags as $tag) { echo($tag->name) } I get an error: Unknown record property / related component "Tags" on "Article"

    Read the article

  • Doctrine YAML not generating correctly? Or is this markup wrong?

    - by ropstah
    I'm trying to get a many-to-many relationship between Users and Settings. The models seem to be generated correctly, however the following query fails: "User_Setting" with an alias of "us" in your query does not reference the parent component it is related to. $q = new Doctrine_RawSql(); $q->select('{s.*}, {us.*}') ->from('User u CROSS JOIN Setting s LEFT JOIN User_Setting us ON us.usr_auto_key = u.usr_auto_key AND us.set_auto_key = s.set_auto_key') ->addComponent('s', 'Setting s INDEXBY s.set_auto_key') ->addComponent('us', 'User_Setting us') ->where(u.usr_auto_key = ?',$this->usr_auto_key); $this->settings = $q->execute(); Does anyone spot a problem? This is my YAML: User: connection: default tableName: User columns: usr_auto_key: type: integer(4) fixed: false unsigned: false primary: true autoincrement: true notnull: true email: type: string(100) fixed: false unsigned: false primary: false default: '' notnull: true autoincrement: false password: type: string(32) fixed: false unsigned: false primary: false default: '' notnull: true autoincrement: false relations: Setting: class: Setting foreignAlias: User refClass: User_Setting local: usr_auto_key foreign: set_auto_key Setting: connection: default tableName: Setting columns: set_auto_key: type: integer(4) fixed: false unsigned: false primary: true autoincrement: true notnull: true name: type: string(50) fixed: false unsigned: false primary: false notnull: true autoincrement: false User_Setting: connection: default tableName: User_Setting columns: usr_auto_key: type: integer(4) fixed: false unsigned: false primary: true autoincrement: false notnull: true set_auto_key: type: integer(4) fixed: false unsigned: false primary: true autoincrement: false notnull: true value: type: string(255) fixed: false unsigned: false primary: false notnull: true autoincrement: false relations: Setting: foreignAlias: User_Setting local: set_auto_key foreign: set_auto_key User: foreignAlias: User_Setting local: usr_auto_key foreign: usr_auto_key

    Read the article

  • Doctrine 1.2: Can a model have two instances of the sluggabl behavior?

    - by prodigitalson
    I dont see any direct mention on using multiple slugs (or any behavior for that matter) for single model. Is there a way to use the sluggable behavior to generate two separate slugs for a model? For example i need to generate two slugs for every record a product_id consisting of a slugified company name and sku and a distributor_id consisting of a different slugified company name. Obviously i could write this myself fairly easily, im just wondering if this can be done quickly with Sluggable.

    Read the article

  • how to check if entity already exists in database before inserting in doctrine?

    - by fayer
    whenever i insert a entity that already exists in database (i have a unique constraint on email) i get an error message on the screen. so i want to check if it already exists, if not i insert it. at the moment it looks like this: $q = Doctrine_Query::create() ->from('User u') ->where('u.email = ?', $email); $object = $q->fetchOne(); if( ! is_object($object)) { $user = new User(); $user-email = $email; $user->save(); } i wonder, if there an easier way to do this? thanks

    Read the article

  • Correct way to set the driverOptions for Doctrine DBAL configuration in symfony2

    - by yesIcan
    I have set driverOptions in the config file as mentioned in the doctrine DBAL documentation. But this gives and error 1/1 InvalidConfigurationException: Unrecognized options "driverOptions" under "doctrine.dbal.connections.pdoDevCon" My config file is dbal: default_connection: pdoDevCon connections: pdoDevCon: driver: %dev_database_driver% # < host: %dev_database_host% # | port: %dev_database_port% # | Defined in user: %dev_database_user% # | password: %dev_database_password% # < charset: UTF8 driverOptions: {3: 2} mapping_types: enum: string set: string orm: auto_generate_proxy_classes: %kernel.debug% pdoDevCon: connection: pdoDevCon mappings: AcmeDemoBundle: ~ AcmeHelloBundle: ~ I am using PDO::ATTR_ERRMODE as 3 PDO::ERRMODE_EXCEPTION as 2, it does not work even if i use the strings.

    Read the article

  • Fatal error: Call to a member function getAttribute() on a non-object in C:\xampp\htdocs\giftshoes\s

    - by Sadiqur Rahman
    I am getting following error message when using Doctrine ORM in Codeigniter. Please help me... ------------------Doctrin Table Defination------------- abstract class BaseShoes extends Doctrine_Record { public function setTableDefinition() { $this-setTableName('shoes'); $this-hasColumn('sku', 'integer', 11, array('primary' = true, 'autoincrement' = false)); $this-hasColumn('name', 'string', 255); $this-hasColumn('keywords', 'string', 255); $this-hasColumn('description', 'string'); $this-hasColumn('manufacturer', 'string', 20); $this-hasColumn('sale_price', 'double'); $this-hasColumn('price', 'double'); $this-hasColumn('url', 'string'); $this-hasColumn('image', 'string'); $this-hasColumn('category', 'string', 50); } public function setUp() { } } ------------------------Doctrin Table Code ------------------- class ShoesTable extends Doctrine_Table { function getAllShoes($from = 0, $total = 15) { $q = Doctrine_Query::create() -from('Shoes s') -limit($total) -offset($from); return $q->execute(array(), Doctrine::HYDRATE_ARRAY); } } -----------------Model Code----------------- class Shoes extends BaseShoes { function __construct() { $this-table = Doctrine::getTable('shoes'); } public function getAllShoes() { $this-table-getAllShoes(); } } -------------------ERROR I am getting-------------------- ( ! ) Fatal error: Call to a member function getAttribute() on a non-object in C:\xampp\htdocs\giftshoes\system\database\doctrine\Doctrine\Record.php on line 1424 Call Stack Time Memory Function Location 1 0.0011 327560 {main}( ) ..\index.php:0 2 0.0363 3210720 require_once( 'C:\xampp\htdocs\giftshoes\system\codeigniter\CodeIgniter.php' ) ..\index.php:116 3 0.0492 3922368 Welcome-Welcome( ) ..\CodeIgniter.php:201 4 0.0817 6234096 CI_Loader-model( ) ..\welcome.php:14 5 0.0824 6248376 Shoes-__construct( ) ..\Loader.php:184 6 0.0824 6248424 Doctrine_Core::getTable( ) ..\Shoes.php:5 7 0.0824 6248424 Doctrine_Connection-getTable( ) ..\Core.php:1080 8 0.0824 6254304 Doctrine_Table-__construct( ) ..\Connection.php:1123 9 0.0841 6396128 Doctrine_Table-initDefinition( ) ..\Table.php:249 10 0.0841 6397472 Shoes-__construct( ) ..\Table.php:301 11 0.0841 6397680 Doctrine_Access-__set( ) ..\Access.php:0 12 0.0841 6397680 Doctrine_Record-set( ) ..\Access.php:60

    Read the article

  • Locating memory leak in Apache httpd process, PHP/Doctrine-based application

    - by Sam
    I have a PHP application using these components: Apache 2.2.3-31 on Centos 5.4 PHP 5.2.10 Xdebug 2.0.5 with Remote Debugging enabled APC 3.0.19 Doctrine ORM for PHP 1.2.1 using Query Caching and Results Caching via APC MySQL 5.0.77 using Query Caching I've noticed that when I start up Apache, I eventually end up 10 child processes. As time goes on, each process will grow in memory until each one approaches 10% of available memory, which begins to slow the server to a crawl since together they grow to take up 100% of memory. Here is a snapshot of my top output: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1471 apache 16 0 626m 201m 18m S 0.0 10.2 1:11.02 httpd 1470 apache 16 0 622m 198m 18m S 0.0 10.1 1:14.49 httpd 1469 apache 16 0 619m 197m 18m S 0.0 10.0 1:11.98 httpd 1462 apache 18 0 622m 197m 18m S 0.0 10.0 1:11.27 httpd 1460 apache 15 0 622m 195m 18m S 0.0 10.0 1:12.73 httpd 1459 apache 16 0 618m 191m 18m S 0.0 9.7 1:13.00 httpd 1461 apache 18 0 616m 190m 18m S 0.0 9.7 1:14.09 httpd 1468 apache 18 0 613m 190m 18m S 0.0 9.7 1:12.67 httpd 7919 apache 18 0 116m 75m 15m S 0.0 3.8 0:19.86 httpd 9486 apache 16 0 97.7m 56m 14m S 0.0 2.9 0:13.51 httpd I have no long-running scripts (they all terminate eventually, the longest being maybe 2 minutes long), and I am working under the assumption that once each script terminates, the memory it uses gets deallocated. (Maybe someone can correct me on that). My hunch is that it could be APC, since it stores data between requests, but at the same time, it seems weird that it would store data inside the httpd process. How can I track down which part of my app is causing the memory leak? What tools can I use to see how the memory usage is growing inside the httpd process and what is contributing to it?

    Read the article

  • Oddities when mixing Zend Framework 1.11 & Doctrine 2 Autoloaders

    - by jiewmeng
    I have setup autoloading in my ZF/Doctrine2 app as follows $zendAutoloader = Zend_Loader_Autoloader::getInstance(); $autoloader = array(new ClassLoader('Symfony'), 'loadClass'); $zendAutoloader->pushAutoloader($autoloader, 'Symfony'); $autoloader = array(new ClassLoader('Doctrine'), 'loadClass'); $zendAutoloader->pushAutoloader($autoloader, 'Doctrine'); $autoloader = array(new ClassLoader('Application', realpath(__DIR__ . '/..')), 'loadClass'); $zendAutoloader->pushAutoloader($autoloader, 'Application'); $autoloader = array(new ClassLoader('DoctrineExtensions'), 'loadClass'); $zendAutoloader->pushAutoloader($autoloader, 'DoctrineExtensions'); I find that the DoctrineExtensions autoloading is not working while other classes are ... to verify that the path etc are right, I tried $autoloader = new ClassLoader('DoctrineExtensions'); $autoloader->register(); And it works. So it seems it has something to do with Zend Framework?

    Read the article

  • Symfony deploying issue

    - by medhad
    I have some problem while configuring symfony project on the production server. When I run the command doctrine --build --all --and-load it gives me error in the production environment: doctrine Dropping "doctrine" database PHP Notice: Undefined index: dbname in /var/www/sf_project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1472 Notice: Undefined index: dbname in /var/www/sf_project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1472 doctrine SQLSTATE[42000]: Syntax error or access violation: 1064 You have an erro...e right syntax to use near '' at line 1. Failing Query: "DROP DATABASE " doctrine Creating "dev" environment "doctrine" database PHP Notice: Undefined index: dbname in /var/www/sf_project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1439 However after the error it creates the table successfully. But if I run the command second times it fails partially while crating the tables. I have changed my database.yml configuration properly for the production environment. here it is: all: doctrine: class: sfDoctrineDatabase param: dsn: mysql:host=localhost;dbname=sf_project port: 3306 username: root password: mainserver Its working right in the local environment though. Can some one shed some light on it ?

    Read the article

  • Updating an Entity through a Service

    - by GeorgeK
    I'm separating my software into three main layers (maybe tiers would be a better term): Presentation ('Views') Business logic ('Services' and 'Repositories') Data access ('Entities' (e.g. ActiveRecords)) What do I have now? In Presentation, I use read-only access to Entities, returned from Repositories or Services, to display data. $banks = $banksRegistryService->getBanksRepository()->getBanksByCity( $city ); $banksViewModel = new PaginatedList( $banks ); // some way to display banks; // example, not real code I find this approach quite efficient in terms of performance and code maintanability and still safe as long as all write operations (create, update, delete) are preformed through a Service: namespace Service\BankRegistry; use Service\AbstractDatabaseService; use Service\IBankRegistryService; use Model\BankRegistry\Bank; class Service extends AbstractDatabaseService implements IBankRegistryService { /** * Registers a new Bank * * @param string $name Bank's name * @param string $bik Bank's Identification Code * @param string $correspondent_account Bank's correspondent account * * @return Bank */ public function registerBank( $name, $bik, $correspondent_account ) { $bank = new Bank(); $bank -> setName( $name ) -> setBik( $bik ) -> setCorrespondentAccount( $correspondent_account ); if( null === $this->getBanksRepository()->getDefaultBank() ) $this->setDefaultBank( $bank ); $this->getEntityManager()->persist( $bank ); return $bank; } /** * Makes the $bank system's default bank * * @param Bank $bank * @return IBankRegistryService */ public function setDefaultBank( Bank $bank ) { $default_bank = $this->getBanksRepository()->getDefaultBank(); if( null !== $default_bank ) $default_bank->setDefault( false ); $bank->setDefault( true ); return $this; } } Where am I stuck? I'm struggling about how to update certain fields in Bank Entity. Bad solution #1: Making a series of setters in Service for each setter in Bank; - seems to be quite reduntant, increases Service interface complexity and proportionally decreases it's simplicity - something to avoid if you care about code maitainability. I try to follow KISS and DRY principles. Bad solution #2: Modifying Bank directly through it's native setters; - really bad. If you'll ever need to move modification into the Service, it will be pain. Business logic should remain in Business logic layer. Plus, there are plans on logging all of the actions and maybe even involve user permissions (perhaps, through decorators) in future, so all modifications should be made only through the Service. Possible good solution: Creating an updateBank( Bank $bank, $array_of_fields_to_update) method; - makes the interface as simple as possible, but there is a problem: one should not try to manually set isDefault flag on a Bank, this operation should be performed through setDefaultBank method. It gets even worse when you have relations that you don't want to be directly modified. Of course, you can just limit the fields that can be modified by this method, but how do you tell method's user what they can and cannot modify? Exceptions?

    Read the article

  • Doctrine_Table_Exception: Unknown relation alias shoesTable in /home/sadiqsof/public_html/projects/g

    - by Sadiqur Rahman
    I am getting following error message: Doctrine_Table_Exception: Unknown relation alias shoesTable in /home/sadiqsof/public_html/projects/giftshoes/system/database/doctrine/Doctrine/Relation/Parser.php on line 237 My Code is below: ------------BaseShoe------------ <?php // Connection Component Binding Doctrine_Manager::getInstance()->bindComponent('Shoes', 'sadiqsof_giftshoes'); /** * BaseShoes * * This class has been auto-generated by the Doctrine ORM Framework * * @property integer $sku * @property string $name * @property string $keywords * @property string $description * @property string $manufacturer * @property float $sale_price * @property float $price * @property string $url * @property string $image * @property string $category * @property Doctrine_Collection $Viewes * * @package ##PACKAGE## * @subpackage ##SUBPACKAGE## * @author ##NAME## <##EMAIL##> * @version SVN: $Id: Builder.php 6820 2009-11-30 17:27:49Z jwage $ */ abstract class BaseShoes extends Doctrine_Record { public function setTableDefinition() { $this->setTableName('shoes'); $this->hasColumn('sku', 'integer', 4, array( 'type' => 'integer', 'fixed' => 0, 'unsigned' => false, 'primary' => true, 'autoincrement' => false, 'length' => '4', )); $this->hasColumn('name', 'string', 255, array( 'type' => 'string', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false, 'length' => '255', )); $this->hasColumn('keywords', 'string', 255, array( 'type' => 'string', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false, 'length' => '255', )); $this->hasColumn('description', 'string', null, array( 'type' => 'string', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false, 'length' => '', )); $this->hasColumn('manufacturer', 'string', 20, array( 'type' => 'string', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false, 'length' => '20', )); $this->hasColumn('sale_price', 'float', null, array( 'type' => 'float', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false, 'length' => '', )); $this->hasColumn('price', 'float', null, array( 'type' => 'float', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false, 'length' => '', )); $this->hasColumn('url', 'string', null, array( 'type' => 'string', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false, 'length' => '', )); $this->hasColumn('image', 'string', null, array( 'type' => 'string', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false, 'length' => '', )); $this->hasColumn('category', 'string', 50, array( 'type' => 'string', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false, 'length' => '50', )); } public function setUp() { parent::setUp(); $this->hasMany('Viewes', array( 'local' => 'sku', 'foreign' => 'sku')); } } --------------ShoesTable-------- <?php class ShoesTable extends Doctrine_Table { function getAllShoes($from = 0, $total = 15) { $q = Doctrine_Query::create() ->from('Shoes') ->limit($total) ->offset($from); return $q->execute(array(), Doctrine::HYDRATE_ARRAY); } } ---------------Shoes Model----------------- <?php /** * Shoes * * This class has been auto-generated by the Doctrine ORM Framework * * @package ##PACKAGE## * @subpackage ##SUBPACKAGE## * @author ##NAME## <##EMAIL##> * @version SVN: $Id: Builder.php 6820 2009-11-30 17:27:49Z jwage $ */ class Shoes extends BaseShoes { function __construct() { parent::__construct(); $this->shoesTable = Doctrine::getTable('Shoes'); } function getAllShoes() { return $this->shoesTable->getAllShoes(); } }

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >