Doctrine 1.2 has a method called generateModelFromDb, documented here, that generates model files for all of the tables in a database.
This function accepts an optional third parameter with an array of "options" to use when generating models, the specifics of which are not documented. What options are available for me to specify here?
...
I am making a Doctrine query and I have to do a wildcard match in the where clause. How should I escape the variable that I want to insert?
The query I want to get:
SELECT u.* FROM User as u WHERE name LIKE %var%
The php code until now:
$query = Doctrine_Query::create()
->from('User u')
->where();...
I have three tables:
Project:
...
relations:
User:
local: authorId
foreign: id
Users:
class: User
local: projectId
foreign: userId
refClass: UserProjects
User:
...
relations:
Projects:
class: Project
local: userId
foreign: projectId
refClass: UserProjects
...
I have two objects: File and FileDetail. A File can have many FileDetails, but a FileDetail can only have one File. I can get this to work, but I can't delete anything from the database because of key constraints (I can't delete the File row because FileDetail depends on it, and vice versa). I have the following yaml:
File:
columns:
...
I'm trying to check for the existence of a table before dropping it. I've read through the API documentation for Doctrine_Table and I can't seem to find anything like this. Is there something I'm missing?
I've got code that looks like:
$table = new Doctrine_Table('model_name', $conn);
$export = new Doctrine_Export();
$export->dropTab...
I'm getting a weird error in symfony 1.4 with doctrine 1.2. My schemas seem to be normal. But whenever I execute the doctrine:build --all --no-confirmation --and-load task, it would output the error SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'default_edition_id' cannot be null. If I set notnull to false for the default_...
The prototype of embedRelation makes reference to an 'options' array (passed as $formArguments/$formargs).
Is it possible to pass an options array:
embedRelation("Model","ModelForm",$options_arr);
Where the options_arr contains form validator/widgets/etc to set for the relation?
$formargs['something']['publish_date'] = new sfWidget...
I need to set value in mapped record to some arbitrary sql expression, so on obj.save() it would be used directly, w/out escaping/quoting.
Something like this:
obj.location = "Point($x, $y)";
obj.save();
Which should result in query like UPDATE ... SET location = Point(..., ...) WHERE ...;
However I cannot find anything like this i...
I am using Doctrine::generateModelsFromYaml(). It creates a directory filled with base classes. Cool. I'm guessing the point of separating the base classes is to store only column definitions and relationships (in other words, only things that can be gleamed from the DB. The extension models, on the other hand, will be edited with behavi...
When using Doctrine::generateYamlFromDb(), can I specify a prefix to use?
For example, if the table name is "user", by default, the generated class name would be "User". Can I make sure the class name (and filename) is "PrefixUser"?
...
Doctrine_Core::createTablesFromModels() is failing with the following error:
Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'newmexicocreates.address_type' doesn't exist. Failing Query: "SELECT a.id AS a__id, a.title AS a__title FROM address_...
I search a good resources with examples to use a doctrine memcached and zend framework.
i search in google but not found, i need resource that Combine all this things.
using Doctrine_Cache_Memcache in zend framework.
thanks
...
I have a field that is defined as follows:
class Subcategory extends BaseSubcategory {}
abstract class BaseSubcategory extends Doctrine_Record
{
public function setTableDefinition()
{
// ...
$this->hasColumn('meta_description', 'string', 255);
// ...
}
// ...
}
Here's what the table looks like...
Product has many product images.
I want to grab a bunch of products, while only getting one product image each. What's the DQL syntax for that?
I'm using Doctrine 1.2.
...
I'm creating a behavior (one template and one listener). In the template class, I'm using the addListener() method to attach the listener to the model.
// Inside the template's setTableDefinition() method
$this->addListener(new RemoraSaveListener);
Pretty standard stuff, it seems.
From within the listener, how to I access the templa...
I'm trying to define conditions on relationships with Doctrine. Is it possible?
I mean something like this:
class User extends Doctrine_Record
{
public function setUp()
{
$this->hasMany('Article as ReallySpecialArticles', array(
'local' => 'id',
'foreign' => 'user_id',
'conditions' =...
I'm currently using Doctrine 1.2.2 with MySQL on the backend. When I attempt to retrieve a result set for more than one item using the record or lazy load hydration modes, only a single item shows up. However, when I use the array hydration mode, I see all of the results. Consistently, only the last item in the result set is retrieved.
...
I have a model class (obviously, it extends Doctrine_Record) that "acts as" a custom template.
I want to get values like this: "echo $record->virtual_field". Is there a way to override the getter method in my custom template to provide a custom response, then either pass on the request to the parent class or not?
In other words, is th...
The title says it all really. Have been using it for a while with CodeIgniter and I can't remember if I installed v2 or just copied the files from another project.
Any ideas?
...
I am using Doctrine 1.2 & ZF 1.10. I have my Doctrine CLI setup fine to do the default tasks. But I have created a couple classes I would like to be able to execute from the command line. How would I setup my application.ini or doctrine.php to register and use these new classes? For instance, I want to be able to execute APPLICATION_PATH...